KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
The answer to Mail multipart/alternative vs multipart/mixed suggests that attachments should be peers of the multipart/alternative message, like: multipart/mixed multipart/alternative text/plain text/html some/thing (disposition: attachment) some/thing (disposition: attachment) ... I'd like to send email with an html part with some inline images and a plain text alternative. What is the preferred MIME layout for the various parts? A couple of options appear in example code and in other questions, but which have worked best in practice? My inclination is this: multipart/alternative text/plain multipart/related text/html (referencing the images by cid) image/gif image/gif ... That way, the images are clearly for the purpose of rendering the html part. A full example of this would be: From: Rich Example <rich-example@example.org> To: A Recipient <recipient@example.org> Subject: An example of email with images and a plain alternative MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="outer-boundary" This is a MIME-encoded message. If you are seeing this, your mail reader is old. --outer-boundary Content-Type: text/plain; charset=us-ascii This message might make you :) or it might make you :( --outer-boundary MIME-Version: 1.0 Content-Type: multipart/related; type="text/html"; start="<body@here>"; boundary="inner-boundary" --inner-boundary Content-Type: text/html; charset=us-ascii Content-Disposition: inline Content-ID: <body@here> <html> <body> This message might make you <img src="cid:smile@here" alt="smile"> or it might make you <img src="cid:frown@here" alt="frown"> </body> </html&g
Tags (comma-separated)
Save Edits
Cancel