0 votes
by (170 points)
edited

We receive some e-mails that have different parts of the body text with encoded text in the middle. For example, the raw message data looks like this:

User-typed text part 1.

--=_cp-mail01.itfreedom.com-13728-1258556277-0001-2
Content-Type: image/tiff; x-unix-mode=0666; name="pastedGraphic.tiff"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
    filename=pastedGraphic.tiff
X-WatchGuard-AntiVirus: scanned 'pastedGraphic.tiff'. clean action=allow

[large chunk of encoded data here]

--=_cp-mail01.itfreedom.com-13728-1258556277-0001-2
Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes
Content-Transfer-Encoding: 7bit
X-WatchGuard-AntiVirus: part scanned. clean action=allow

User-typed text part 2.

Outlook Express displays it like this:

User-typed text part 1.

<P><HR></P>

User-typed text part 2.

But when I retrieve the body text, I don't see anything from part 2. Part 2 usually seems to be a duplicate of part 1, or in some cases is the part of the e-mail that is quoted from a previous e-mail in a reply. I have tested a few other e-mail parsers, and they also do not return part 2. Can anyone shed some light on this for me?

by (148k points)
Would it be possible to post the Content-Type header that is present just above the "User-typed text part 1."? Also, is that a part of the headers at the beginning of the message? That should make it possible to tell what is going on.

1 Answer

0 votes
by (148k points)
edited

It's not yet possible to tell for sure (see my comment above), but I guess that "User-typed text part 2" is parsed and treated as an attachment. If this is the case, it should be accessible through MailMessage object's Attachments collection (just like the tiff image)

Outlook Express routinely displays image and text attachments, separated by <HR>, which might be what it did here as well.

by (170 points)
You are right - the second part is coming through as an attachment, which I assume is how it should be based on the way it is formatted. The header above "User-typed text part 1" is this: --=_cp-mail01.itfreedom.com-13728-1258556277-0001-2 Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-WatchGuard-AntiVirus: part scanned. clean action=allow Thanks for your help!
by (148k points)
Oops, sorry, the header just above is not the one I was really interested in - what I should have asked for is the header above that (most likely multipart/mixed).
by (170 points)
Here is the header above: Content-Type: multipart/mixed; boundary="=_cp-mail01.itfreedom.com-13728-1258556277-0001-2" X-Mailer: Apple Mail (2.936) X-WatchGuard-Spam-ID: str=0001.0A010208.4B040C73.0160:SCFSTAT4691433,ss=1,fgs=0 X-WatchGuard-AntiVirus: part scanned. clean action=allow This is a MIME-formatted message. If you see this text it means that your E-mail software does not support MIME-formatted messages.
by (148k points)
Thanks! This confirms that "User-typed text part 2" is indeed an attachment. If you would like to append it to "User-typed text part 1", you would have to do that yourself.
by (170 points)
Great. Thank you so much for your prompt help.
...