Good morning
My first post in this forum concerns mail 2.8.1 with Ruby 3.1.2p20
I appear to be unable to split a mail-body into parts. From what I read in body.rb from the Mail gem, a Regexp is created from my String-argument (boundary) by appending two dashes.
So, I see these boundaries in an authentic mail:
------=_Part_291375_1214917593.1717165035012
and create my boundary like this:
body.split!("\=_Part_")
parts = body.parts
debug "first part: " << parts[0].to_s
Unfortunately, parts[0] always contains all parts, i.e. the whole message-body, part[1] does – in consequence – not exist.
I notice that, no matter how many dashes I include in the boundary argument, the boundary which is stored by Mail::Body#split! is always missing two dashes. Authentic debug output:
EmlFile debug 10:15:12:703794: first part: Content-Type: multipart/alternative;
| boundary=“----=_Part_291375_1214917593.1717165035012”
|Content-Transfer-Encoding: 7bit
|
|
|------=_Part_291375_1214917593.1717165035012
|Content-Type: text/plain;
| charset=UTF-8
|Content-Transfer-Encoding: quoted-printable
Here, I used a call body.split!("----\=_Part_")
, but, no matter how many dashes I use, I cannot match the original boundary in the mail.
Does anybody know something ?
2.) ri Mail informs me that
This whole class and associated specs is deprecated and will go away in
the version 3 release of mail.
I am reluctant to give up on this gem, because I use it for years, but maybe you can recommend something similar for Mail processing, excluding all network-activity.
TIA
Michael
P.S.: you do not need to mask the ‘=’ in the boundary-String, but I leave it here for authenticity.