Search code examples
emailcontent-typemime

Multipart/alternative subtype, when client use it?


Why webmails (like Gmail) sends MIME messages using multipart/alternative subtype (when composing in HTML) while others send HTML as MIME with text/html parts inside (without using alternative subtype)?


Solution

  • multipart/alternative indicates that each part is an "alternative" version of the same (or similar) content, each in a different format denoted by its "Content-Type" header. The formats are ordered by how faithful they are to the original, with the least faithful first and the most faithful last.

    Mail-agents like Gmail know what they are doing, and convert the text/html to text/plain and put both alternatives into there emails and let the receiving end decide which alternative to use.

    There are also mail-agents that don't know how to extract a text-only version from the html content, just because the developer did not bother to implement it, so they only send text/html with out any alternatives.

    And sometimes - i call them the crazy ones - send multipart/alternative, but actually only put text/html without any alternatives. Which is not really nice, but it is not against any spec.