Microsoft Store
 

MIME


 

Multipurpose Internet Mail Extensions (MIME) is an Internet Standard for the format of e-mail. Virtually all Internet e-mail is transmitted via SMTP in MIME format. Internet e-mail is so closely associated with the SMTP and MIME standards that it is sometimes called SMTP/MIME e-mail.

MIME headers

MIME-Version

The presence of this header indicates the message is MIME-formatted. The value is typically "1.0" so this header appears as

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

MIME-Version: 1.0

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Content-Type

This header indicates the type and subtype of the message content, for example

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Content-type: text/plain

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

The combination of type and subtype is generally called a MIME type. A large number of file formats have registered MIME types. Any text type has an additional charset parameter that can be included to indicate the character encoding. A very large number of character encodings have registered MIME charset names.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Although originally defined for MIME e-mail, the content-type header and MIME type registry is reused in other Internet protocols such as HTTP.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Through the use of the multipart type, MIME allows messages to have parts arranged in a tree structure where the leaf nodes are any non-multipart content type and the non-leaf nodes are any of a variety of multipart types.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

This mechanism supports:

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

  • simple text messages using text/plain (the default value for "Content-type:")
  • text plus attachments (multipart/mixed with a text/plain part and other non-text parts). A MIME message including an attached file generally indicates the file's original name with the "Content-disposition:" header, so the type of file is indicated both by the MIME content-type and the (usually OS-specific) filename extension.
  • reply with original attached (multipart/mixed with a text/plain part and the original message as a message/rfc822 part)
  • alternative content, such as a message sent in both plain text and another format such as HTML (multipart/alternative with the same content in text/plain and text/html forms)
  • many other message constructs

Content-Transfer-Encoding

MIME (RFC 2045) defines a set of methods for representing binary data in ASCII text format. The content-transfer-encoding: MIME header indicates the method that has been used. The RFC and the IANA's list of transfer encodings define the following values, which are not case sensitive:

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

  • Suitable for use with normal SMTP:
  • 7bit - up to 998 octets per line of the code range {CR, LF}. This is the default value.
  • quoted-printable - used for text data consisting primarily of US-ASCII characters but also containing characters outside that range.
  • base64 - used for arbitrary binary data
  • Suitable for use with SMTP servers that support the 8BITMIME transport SMTP extension:
  • 8bit - up to 998 octets per line ending with CR+LF; octets must be in the code range {CR, LF}.
  • Not suitable for use with SMTP:
  • binary - any sequence of octets. Not usable with SMTP mail.
  • There is no encoding defined which is explicitly designed for sending arbitary binary data through 8BITMIME transports, thus base64 or quoted-printable must sometimes still be used.

    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~