I’ve had a couple of people ask me about MIME structure recently, especially how you create multipart messages, when you should use them and which variant of multipart you use for different things. (And I’m working on a MIME parser / generator for Abacus at the moment, so it’s all fresh in my mind)
So I’ve put together a quick cheat sheet, showing the structure of four common types of email, and how their MIME structure looks.
Simple plain text
text/plain
Plain text with a PDF attachment
multipart/mixed
text/plain
application/pdf
HTML with a plain text fallback
multipart/alternative
text/plain
text/html
HTML with embedded images and plain text fallback
multipart/alternative
text/plain
multipart/related
text/html
image/gif
image/gif
image/jpeg