Search code examples
emailmime-typescontent-typemimecontent-disposition

Looking for a strategy to implement publish capability via email


Imagine you want to provide the ability to publish news on your website sending an email to a given address (like for example publish.news@domain.com).

1) The base strategy is: look for something that is text/html and not disposition, and this is the primary body of the email.

2) Then look for any other content that is disposition and is attachment (and you'll get all the attachments).

3) Discard any other content that is disposition and inline because, correct me if i'm wrong, it's kinda stuff like email signature and thus not needed.

So far so good this strategy works good. However i don't know how to:

  • deal with multipart/alternative content. Some clients seems to compose HTML with this primary/subtype content-type.
  • deal with multipart/mixed (even don't know what it means).
  • if any email clients let to compose in html adding your own images and encoding them in some way.

Any help is much appreciated.


Solution

  • multipart/alternative just means that each part is an alternative version of the same thing, just with a different content type (say, an HTML version and a plaintext version).

    multipart/mixed is used to put different content types inline. This will allow a client to put (say) an image inline in a message that is otherwise (say) plaintext.

    You can read about all the multipart MIME types in the spec at https://www.rfc-editor.org/rfc/rfc2046#section-5.1 or in the Wikipedia article.