Multipurpose Internet Mail Extensions
Multipurpose Internet Mail Extensions (MIME) is a standard for handling emails that may not exclsively contain printable ASCII characters.
Contents
Structure
Header
A MIME message begins with:
MIME-Version: 1.0
In theory there could be breaking changes in a different version of MIME, but the standard does not cover how a different version should be handled by message agent that do not support it. As such, MIME is stuck at version 1.0 permanently.
Content Types
A MIME message continues with a line like:
Content-Type: multipart/mixed
A MIME message containing just ASCII text could use a content type of text/plain. But in practice, most MIME messages contain at least an HTML formatted message (text/html) and a test message (text/plain). In this case, the message has a type of multipart/mixed and each component of the message will have a new content type.
In the case of a multipart message, the content type looks like:
Content-Type: multipart/alternative; boundary="_000_CY4PR11MB1894D7 22452F4E01EBDDC61E85790CY4PR11MB1894namp_"
The message should be scanned for the boundary to identify the separable components.
A character set may also be specified like
Content-Type: text/plain; charset="utf-8"
Note that the character set values are not well specified.
Content Transfer Encoding
A MIME message or component may continue with a specification of the character encoding. This generally is only seen in use with base64...
Content-Type: application/octet-stream Content-Transfer-Encoding: base64
...or quoted-printable.
Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable