Mangled MIME Headers in plain text mail

Mark Sapiro mark at msapiro.net
Sun Apr 19 16:37:13 IST 2009


On Sat, Apr 18, 2009 at 09:28:10PM +0100, Drew Marshall wrote:
> 
> To explain more, it seems that plain text only mails are fine,  
> processed, signature added and all is well. Combined HTML and plain  
> text mail the HTML section is fine and as that is the default view of  
> most mail clients, no problem. However, if you then view this mail in  
> plain text such as you might on a blackberry or other mobile type  
> device the actual message is not visible, only the clean mail  
> signature. When I look at the the raw message, it is there but beneath  
> the signature and (I am no expert in MIME formatting) seems to be set  
> with a different structure that the signature and hence not visible to  
> 'simple' clients (If you view the message in a half decent client, the  
> message is visible under the signature).
> 
> For example this is part of a raw message:
> 
> ------_=_NextPart_6334_00018467.00000041
> Content-Type: text/plain; charset="ISO-8859-1"
> Content-Disposition: inline
> Content-Transfer-Encoding: quoted-printable
> 
> --=20
> This message has been scanned for viruses and dangerous content by=20
> the Mail Launder e-mail system.
> For more information please visit http://www.mail-launder.com=20
> 
> 
> 
> 
> ------_=_NextPart_6334_00018467.00000041
> Content-Type: text/plain;
> 	charset="us-ascii"
> Content-Transfer-Encoding: quoted-printable
> 
> <-- The text from here is not visible in a plain text view -->
> 
> I can't  see any particular commonality in clients although I did  
> originally think it was Thunderbird but Outlook also has been involved  
> in mail that displays this problem. Prior to the current beta being  
> installed, I did have one user who had her out bound mail (From  
> Outlook) sent as plain text attachments with just the signature  
> actually in the message. I haven't heard of any more of these but I  
> guess most people don't get formatting feed back for mail they send :-)



The original message is multipart/alternative. Since it is multipart,
the MailScanner signature is added to the beginning of the message as
a separate MIME text/plain part. The resultant message structure is
something like

multipart/mixed
    text/plain  (the signature)
    multipart/alternative  (the original message)
        text/plain  (the original plain text body)
        text/html   (the original rich text body)

Or, in the case of the message you refer to in a followup, the original
is apparently

multipart/mixed
    text/plain (your text)
    application/x-gzip (your attachment)

And with the MailScanner signature

multipart/mixed
    text/plain  (the signature)
    text/plain (your text)
    application/x-gzip (your attachment)

The Blackberry and some other MUAs think the first text/plain
part is the message and everything else is an attachment.

For a discussion of this issue in a different context and the
reasons why the signature can't just be 'inserted' into the body, see
<http://wiki.list.org/x/84A9>.

-- 
Mark Sapiro mark at msapiro net       The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan


More information about the MailScanner mailing list