What is MIME (Multipurpose Internet Mail Extensions)?
MIME (Multipurpose Internet Mail Extensions) is an extension of the original Simple Mail Transport Protocol (SMTP) email protocol. It lets users exchange different kinds of data files, including audio, video, images and application programs, over email.
Unlike SMTP, MIME supports sending both ASCII text and non-ASCII data via email. For text in character sets other than ASCII, the MIME protocol is required.
Drawbacks of SMTP
SMTP, which emerged in 1981, is a standard protocol for delivering messages via email. However, the original SMTP protocol supported only 7-bit ASCII text communications that were both unauthenticated and unencrypted. With only 94 printable characters in ASCII, the system cannot deal with binary files or characters in non-English languages that use different writing systems, accented letters, etc.
Pure SMTP also does not accommodate sending video or audio data.
The default design of every SMTP server was an open mail relay that lets anyone send emails through it, not just those from or to known users. These limitations made SMTP communications vulnerable to email spoofing, spamming, worms and man-in-the-middle (MitM) attacks.
MIME was proposed as a solution to these limitations.
Origins of MIME
In 1991, Nathaniel Borenstein, then a technical staff member at Bellcore, proposed to the Internet Engineering Task Force (IETF) that SMTP be extended so web (and other internet) clients and servers could recognize and handle all kinds of data, not just Latin-based ASCII text, and to allow the encoding of binary files for transfer through SMTP.
As a result, new file types were added to "mail" as a supported Internet Protocol file type. MIME is not restricted to textual data and is also important for other communication protocols, even though it was originally designed only to address the shortcomings of email and SMTP.
Advantages of MIME
MIME has several advantages over SMTP.
- Users can send different kinds of binary attachments via email.
- Multiple attachments of different types can be included in the same email.
- There are no limits on message length.
- Multipart messages are supported.
MIME defines four subtypes for multipart messages, specifying the nature of these parts and their relationship to one another. In particular, the "multipart/alternative" subtype lets systems choose the best representation of the message: plain text or HTML.
How MIME works
Emails with MIME formatting may be transmitted via standard protocols like SMTP, Post Office Protocol (POP) or Internet Message Access Protocol (IMAP). The body of such messages may consist of multiple parts. The header may be specified in non-ASCII character sets MIME supports. IETF's RFC 2045 defines the various headers used to describe the structure of MIME messages.
Servers insert the MIME header at the beginning of an email transmission. Clients use the MIME header to select an appropriate player application for the data type indicated by the header. Some players are built into the web client or browser. For instance, all browsers come with GIF and JPEG image players and can handle HTML files. Other players may need to be downloaded.
At the sender's end, MIME transforms non-ASCII data to 7-bit Network Virtual Terminal (NVT) data. 7-bit ASCII can represent 128 characters. MIME then delivers this transformed data to the client SMTP. At the recipient's end, the message is transferred back to the original data, allowing them to see its contents, regardless of whether it contains text, audio, video or some other kind of data.
MIME header fields
A MIME header contains multiple subparts. These include:
This header field indicates the message is MIME-formatted. Its value is typically "1.0."
This header describes the media type of the content within the message. It consists of a type and a subtype, both of which are strings. When concatenated with a slash (/) between them, the type and subtype comprise a MIME type.
- Type: General category of the data type (e.g., video or text)
- Subtype: Exact kind of data the MIME type represents.
MIME types are case-insensitive. An optional parameter can be added to the MIME type to provide additional details. So, if the parameter is "charset", it will specify the character set used for the data characters. If this parameter is not specified, MIME will use the default ASCII character set.
Using the type "multipart," MIME allows mail messages to have parts arranged in a tree structure to support:
- simple text messages
- text plus attachments
- replies with original message attached
- multiple alternatives in HTML
- images, audio and video
This header specifies the presentation style of email messages. The disposition may be:
- Inline: Automatically displayed when the message is displayed
- Attachment: Not displayed automatically but rather requires some user action (i.e. download)
RFC 2183 specifies the content-disposition header.
This header indicates whether a binary-to-text encoding scheme has been used in addition to the original encoding specified in the content-type header.