Search code examples
emailmime-typesmimeemail-client

Hide text/plain from user in SMTP


To solve a problem where SMTP servers won't display attachments with emails that have content-type set to multipart/alternative, I've had to set the email to multipart/mixed, but this has the unfortunate side-effect of displaying both the plain text and the HTML, which create pointless duplication and is unsightly to the user.

With multipart/mixed set, is there any way to hide 'text/plain' (without removing it as it's going to be used by a parser) from the user and just display the HTML? I am referring only to hiding it for cilent programs (such as hotmail, yahoo, etc) and not IMAP etc where the user can see everything.


Solution

  • If you don't want the text displayed to the user ever, then including it as part of a multipart/mixed message seems like the wrong thing, as the contents of your text/plain part is more correctly metadata. I'd probably put it in a header or something if you can.

    If it must be part of the multipart message, I'd try testing using a custom mime-type that a mail client doesn't know about, and see if that causes the section in question to be hidden. This feels a bit hacky, but it could potentially work.