Previous Page TOC Next Page

Multipurpose Internet Mail Extensions

What is MIME?

MIME is the Multipurpose Internet Mail Extensions specification. It offers a way to interchange text in languages with different character sets, and multimedia e-mail among many different computer systems that use Internet mail standards.

MIME supports several pre-defined types of non-textual message contents, such as GIF image files and PostScript programs. In addition, MIME also permits you to define your own types of message parts.

MIME messages can also contain multiple objects. When multiple objects are in a MIME message, they are represented in a form called a body part. A body part has a header and a body. Body parts can be nested in bodies that contain one or multiple body parts.

The content-type values, subtypes, and parameter names defined in the MIME standard are not case sensitive. However, many parameter values are case sensitive

The MIME standard is written to allow MIME to be extended in certain ways, without having to revise the standard. MIME specifies sets of values that are allowed for various fields and parameters. MIME provides a procedure for extending these sets of values by registering them with an entity called the Internet Assigned Numbers Authority (IANA).

HTTP and MIME

HTTP passes messages in a format similar to that used by Internet Mail MIME.

HTTP includes MIME header information in the protocol. HTML uses the MIME type text and the subtype html (written as text/html) or text and the subtype plain. Web servers and browsers support many other data types.

See the chapter entitled HyperText Transfer Protocol for more information about HTTP and MIME.

How Browsers and Servers Use MIME

Every time a browser requests a page, it sends the server a list of the MIME-types (content-types) it can support. The server knows how to map file types and file extensions to standard MIME data types.

When the server fulfills the request it sends a response to the client. The server tries to send only the MIME types the browser supports. The server responds first with the MIME type of the data that it is sending, then it sends the data.

Content Types

The browser and server include content-type information in the headers they send to each other. The content-type field describes the data contained in the body of the transaction. The content-type field describes the data fully enough so the receiving user agent can pick an appropriate agent or mechanism to present the data to the user, or otherwise deal with the data in an appropriate manner.

The content-type header field specifies the nature of the data in the body of an entity. This header field gives the type and subtype identifiers. Parameters are modifiers of the content-subtype. Parameters provide auxiliary information that may be required for certain types.

Generally, the top-level content-type declares the general type of data, while the subtype specifies a specific format for that type of data. For example, the content-type of image/jpeg is enough to tell a user agent that the data is an image even if the user agent has no knowledge of the specific image format jpeg.

The Content-Type Set

The MIME content-type set defines seven initial content-type values. Table 6 describes the most essential characteristics of the seven content types.

Table 6 The MIME Content Type Set

Content Type

Use

Subtype(s)

Important Parameters

Text

Represents text in a number of character sets and formatted text description languages in a standardized manner.

Plain, html

charset

Multipart

Combines several body parts, possibly of differing types of data, into a single message.

Mixed, alternative, digest, parallel

boundary

Message

To encapsulate a message.

Partial, external-body

id, number, total, access-type, expiration, size, permission, name,

Application

Transmits application data or binary data.

Octet-stream, postscript, rtf, pdf, msword

type, padding

Image

Transmit still image (picture) data.

jpeg, gif, tiff, x-xbitmap

none

Audio

To transmit audio or voice data.

Basic, wav

none

Video

Transmit video or moving images, possibly with audio as part of the composite video data format.

mpeg

none

MIME Mapping Defaults

The HTTP protocol represents each file type as a MIME content-type/subtype pair. The server decides the file’s MIME type by referring to a mapping table . You can add, change, or delete these mappings (see Table 7).

Table 7 Default MIME Data Types in HTTP

File Extension

MIME Type

.HTM, .HTML

text/html

.UTF

text/plain; charset=unicode-1-1

.TXT

text/plain

.PS

application/postscript

.RTF

application/rtf

.PDF

application/pdf

.ZIP

application/zip

.DOC

application/msword

.JPG, .JPEG

image/jpeg

.GIF

image/gif

.TIF, .TIFF

image/tiff

.XBM

image/x-xbitmap

.WAV

audio/wav

.AU

audio/basic

.MPG, .MPEG

video/mpeg

.Default

application/octet-string

You can use MIME types with parameters when creating mappings. Parameters further qualify particular MIME types. A MIME type with a parameter is similar to:

text/plain; charset=UNICODE-1-1

By default, the server maps the file extension UTF to this MIME type.

This example indicates that the corresponding file is a plain text file that uses the Unicode character set. (RFC1641 defines this usage.)

Undisplayed Graphic

The separation between the type and parameter must be a semicolon and a single space; do not use spaces around the equals sign.


Previous Page Page Top TOC Next Page