MIME (Multipurpose Internet Mail Extensions)

Introduction to MIME

MIME (Multipurpose Internet Mail Extensions) is a standard which was proposed by Bell Communications in 1991 in order to expand upon the limited capabilities of email, and in particular to allow documents (such as images, sound, and text) to be inserted in a message. It was originally defined by RFCs 1341 and 1342 in June 1992.

Using headers, MIME describes the type of message content and the encoding used.

MIME adds the following features to email service:

  • Be able to send multiple attachments with a single message;
  • Unlimited message length;
  • Use of character sets other than ASCII code;
  • Use of rich text (layouts, fonts, colors, etc)
  • Binary attachments (executables, images, audio or video files, etc.), which may be divided if needed.

MIME uses special header directives to describe the format used in a message body, so that the email client can interpret it correctly:

  • MIME-Version: This is the version of the MIME standard used in the message. Currently only version 1.0 exists.
  • Content-type: Describes the data's type and subtype. It can include a "charset" parameter, separated by a semi-colon, defining which character set to use.
  • Content-Transfer-Encoding: Defines the encoding used in the message body
  • Content-ID: Represents a unique identification for each message segment
  • Content-Description: Gives additional information about the message content.
  • Content-Disposition: Defines the attachment's settings, in particular the name associated with the file, using the attribute filename.

Primary MIME types

MIME types, used in the Content-Type header, are used to classify documents attached to an email. A MIME type is comprised as follows:

Content-type: main_mime_type/mime_subtype
A GIF image, for example, has the following MIME type:
Content-type: image/gif

The primary data types, sometimes called "discrete data types," are:

  • text: readable text data text/rfc822 [RFC822]; text/plain [RFC2646]; text/html [RFC2854] .
  • image: binary data representing digital images: image/jpeg; image/gif; image/png.
  • audio: digital sound data: audio/basic; audio/wav
  • video: video data: video/mpeg
  • application: Other binary data: application/octet-stream; application/pdf

MIME types are also used on the Web to classify documents transferred using the protocol HTTP. Thus during a transaction between a web server and a browser, the first thing the web server does is send the MIME type of the file to the browser, so that the browser knows how to display the document.

Encoding formats

To transfer binary data, MIME offers five encoding formats which can be used in the header transfer-encoding:

  • 7bit: 7-bit text format (for messages without accented characters);
  • 8bit: 8-bit text format;
  • quoted-printable: Quoted-Printable format, recommended for messages which use a 7-bit alphabet (such as when there are accent marks);
  • base64: Base 64, recommended for sending binary files as attachments;
  • binary: binary format; not recommended.

Since MIME is very open, it can use third-party encoding formats such as:

  • BinHex (a proprietary format belonging to Apple),
  • uuencode,
  • xxencode

Header encoding

The transfer-encoding header is used to specify an encoding format for the message body, but it doesn't solve the problem of encoding headers themselves (such as the message subject).

To encode headers with character sets which use more than 7 bits, such as for including accented letters in an email's subject, the MIME standard offers the following format:

  • charset represents the character set used,
  • encoding defines the encoding desired with two possible values:
    • Q for quoted-printable
    • B for base64
  • result: text encoded using the method specified.
Below is an example of Quoted-Printable encoding with "Building façade" as the email's subject.
Subject: Building fa=?ISO-8859-1?Q?=E7ade?=

Composite messages

With the MIME type "multipart", the MIME standard allows for composite messages, meaning messages which include multiple attachments, which may even be nested.

To do so, MIME allows for a standard called boundary. This is an arbitrary string defined as an attribute in the Content-type header:

Content-Type: multipart/mixed;
Each separator delimits a portion of content beginning with the headers Content-Type and Content-Encoding. It is essential that the value of this separator is not found within the message contents.

There are several types of separators:

  • multipart/mixed defines a series of multiple elements
  • multipart/alternative defines alternatives for the same information, such as a message in either text and HTML format. If the email client is able to display messages with a layout and configured to do so, it will show the HTML version; otherwise, it will display the test version.
  • multipart/parallel defines data present at the same time (such as sound and image).
  • multipart/signed defines a digital signature for message data
  • multipart/related defines related pieces of information

List of MIME types

MIME types are standardized by a group called the IANA (Internet Assigned Numbers Authority). Here is a non-exhaustive list of the most common MIME types.

MIME Type Type of file Associated extension
application/atom+xml Files in ATOM format atom
application/iges CAS files iges
application/javascript JavaScript files js
application/dxf AutoCAD files dxf
application/mp4 MPEG4 files mp4
application/iges IGES CAD exchange format igs,iges
application/octet-stream Non-interpreted binary files bin
application/msword Microsoft Word document files doc
application/pdf Adobe Acrobat files pdf
application/postscript PostScript files ai,eps,ps
application/rtf Rich text format rtf
application/sgml SGML files sgml
application/vnd.ms-excel Microsoft Excel spreadsheet files xls
application/vnd.ms-powerpoint Microsoft Powerpoint presentation files ppt
application/xml XML file xml
application/x-tar Compressed tar files tar
application/zip Compressed ZIP files man
audio/basic Basic audio files au,snd
audio/mpeg MPEG audio files mpg,mp3
audio/mp4 MPEG-4 audio files mp4
audio/x-aiff AIFF audio files aif,aiff,aifc
audio/x-wav Wave audio files wav
image/gif Gif images man
image/jpeg Jpeg images jpg,jpeg,jpe
image/png Images PNG png
image/tiff Tiff images tiff,tif
image/x-portable-bitmap PBM Bitmap files pbm
image/x-portable-graymap PBM Graymap files pgm
image/x-portable-pixmap PBM Pixmap files ppm
multipart/x-zip Zip archive files zip
multipart/x-gzip GNU zip archive files gz,gzip
text/css Style sheet css
text/csv Comma-separated text files csv
text/html HTML files htm,html
text/plain Unformatted text files txt,g,h,c,cc,hh,m,f90
text/richtext Rich text files rtx
text/rtf Rich Text Format text files rtf
text/tab-separated-value Tab-separated text files tsv
text/xml XML files xml
video/h264 H.264 videos h264
video/dv DV videos dv
video/mpeg MPEG videos mpeg,mpg,mpe
video/quicktime QuickTime videos qt,mov
video/msvideo Microsoft Windows videos avi

More Information

  • Official list of MIME types (IANA - )
  • Main RFCs:
    • RFC 2045: MIME Part One: Format of Internet Message Bodies
    • RFC 2046: MIME Part Two: Media Types
    • RFC 2047: MIME Part Three: Message Header Extensions for Non-ASCII Text
    • RFC 2048: MIME Part Four: Registration Procedures
    • RFC 2049: MIME Part Five: Conformance Criteria and Examples
  • Secondary RFCs:
    • RFC 1524: The formal description of mailcap files. Mailcap files describe how to handle media types.
    • RFC 2015: MIME Security with Pretty Good Privacy (PGP).
    • RFC 2110: MIME E-mail Encapsulation of Aggregate Documents, such as HTML (MHTML).
    • RFC 2111: Content-ID and Message-ID Uniform Resource Locators.
    • RFC 2112: The MIME Multipart/Related Content-type.
    • RFC 2183: Defines the syntax and sematics of the "Content-Disposition" header to convey presentational information.
    • RFC 2184: MIME Parameter Value and Encoded Word Extensions: Character Sets, Languages, and Continuations
Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
This document, titled « MIME (Multipurpose Internet Mail Extensions) », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!