i’m trying to parse an email that is supposed to be a multipart/mixed
mail but i am not getting back the expected results.
data = imap.fetch(7, [“ENVELOPE”, “RFC822.HEADER”, “BODYSTRUCTURE”,
“BODY[1]”])
[RFC822.HEADER]
…[some headers removed to protect the innocent]…
From: [email protected]
To: [email protected]
Date: Thu, 31 Aug 2006 19:03:07 -05:00
Content-type: Multipart/Mixed; boundary=Message-Boundary-22611
X-finfo: DOS,“FOOBAR.ZIP”,
Subject: foobar inc. in stock inventory
Priority: normal
X-mailer: Pegasus Mail v3.50
Message-ID: [email protected]
[BODYSTRUCTURE]
#<struct Net::IMAP::BodyTypeText media_type=“TEXT”, subtype=“PLAIN”,
param={“CHARSET”=>“US-ASCII”}, content_id=nil, description=nil,
encoding=“7BIT”, size=218060, lines=2959, md5=nil, disposition=nil,
language=nil, extension=nil>
[BODY[1]
–Message-Boundary-22611
Content-type: text/plain; charset=US-ASCII
Content-description: blah blah blah
blah blah blah
–Message-Boundary-22611
Content-Type: Application/Octet-stream; name=FOOBAR.ZIP
Content-transfer-encoding: BASE64
…[base64 encoded data]…
–Message-Boundary-22611–
as you can see above, the content-type is clearly multipart/mixed, but
yet, when i dump the bodystructure, i get text/plain. the size and
lines corresponds to the size/lines of the body of the email.
anyone got any ideas on this one?
Chris