Internet Protocols Module User’s Guide : PART II Packages of the Internet Protocols Module : Chapter 8 The MIME Package : MIME Basics
MIME Basics
Although the complete specification of the MIME format includes a great deal of detail, the basic principles are easy to understand. This section presents a quick overview of the most important points.
Part and Message
A document in MIME format is referred to as a MIME part. A MIME part that can be used as a top-level document is called a MIME message.
The only difference between a MIME part and a MIME message is that a MIME message contains a MIME-Version header. In this guide, we use “message” to refer to parts with a MIME-Version header.
Part Structure
The basic structure of a MIME part consists of a list of headers and a body. The key feature of the MIME specification is a standardized set of headers that describe the structure and content of the part. Each header field consists of a label and a value. Some values contain one or more parameters. For example, the header:
 
Content-Type: text/plain; charset=us-ascii
contains the label Content-Type and the value text/plain; charset=us-ascii. The value contains the content type text/plain and a single parameter. The parameter contains the name charset and the value us-ascii. In short, the header describes the part body as plain text in the US-ASCII character set. The only role of a MIME header is to describe the content of the part or identify the MIME version used. MIME headers don’t have anything to do with the transport protocol used for the message.
The body of a MIME part is the content of the part. The content can be simple data, such as unstructured text or an encoded image. Alternatively, the part can contain other MIME parts. Each nested MIME part contains its own headers and body.
MIME Headers
Each MIME header in a part contains information about the part. The most important aspect of using the MIME format is understanding the MIME headers. This section presents a quick overview of the headers supported by the MIME package. “Using the MIME Headers Effectively” presents a more detailed look at the MIME headers.
MIME-Version
The MIME-Version header specifies the version of MIME used to construct the MIME part. This header is required for MIME messages, optional for other MIME parts. The MIME specification defines the value of this header to be 1.0.
Example: MIME-Version: 1.0
Content-Type
The Content-Type header describes the type of content the message contains.
Example: Content-Type: image/jpeg
The value of the header has two parts, separated by a forward slash. The first part of the value is the media type, a general description of the content. The second part of the value is the subtype, the specific type of the content.
The MIME specification defines a multipart content type for a part body that contains other MIME parts. All multipart content types require a boundary parameter. The boundary is used to delimit the other MIME parts contained within the part body. Because the boundary is used as a delimiter, the boundary should not appear in any of the contained parts.
Example: Content-Type: multipart/mixed; boundary="_bounds_"
If a part does not have a Content-Type header, the content type of the part is text/plain; charset=us-ascii.
Content-Transfer-Encoding
The Content-Transfer-Encoding header describes whether the body has been processed for transmission. The header also describes the current representation of the body.
Example: Content-Transfer-Encoding: base64
If a part does not have a Content-Transfer-Encoding header, the content transfer encoding of the part is 7bit.
Content-Description
The Content-Description header provides a human-readable description of the content.
Example: Content-Description: Crater Lake photo
Content-ID
The Content-ID header labels a part with a unique identifier. Other parts can refer to the part by using the identifier, even if the other parts are in a different message.
Example: Content-ID: <part91034@roguewave.example>
Content-Location
The Content-Location header labels a part with a URI. Other parts in the same message can refer to the part body by using the URI.
Example: Content-Location: http://roguewave.example/lake.jpg
Content-Disposition
The Content-Disposition header indicates how an application should process a part.
Example: Content-Disposition: inline
Part Body
The body of a part is the actual content of the part. As mentioned earlier, the body can be simply data or, if the Content-Type of the message is multipart, the body can contain other MIME parts.