Platform SDK: Exchange 2000 Server

MIME Message Body Parts

[This is preliminary documentation and subject to change.]

A MIME-formatted message body typically contains a hierarchy of nodes called body parts. Leaf nodes are content body parts, and container nodes are multipart body parts. Multipart body parts do not have content other than other body parts.

The MIME specification defines the core header field content-type to indicate the type of the body part. Content-type is made up of a primary and secondary type. Multipart body parts have a primary type of "multipart." All others have some other defined type other than multipart.

Content Body Parts

A content body part is made up of a header and content field. A header conveys specific information about the content of the message. The content consist of any serialized stream of bytes, from a binary file to Hypertext Markup Language (HTML) formatted text file. When necessary, the content is encoded so that the entire body complies with RFC 822. In this case, MIME defines the header content-transfer-encoding to specify the encoding process. Other details may also be included, such as the content-disposition. The content-disposition indicates to the receiver whether the content is to be treated as an attachment, or to be rendered inline with other body parts. For example, when sending a message that includes an image stored as a *.gif file, the image is treated as an attachment.

Because .gif files use 8-bit bytes, and the RFC 822 format requires messages to contain only US-ASCII text, the image data must be encoded. To correctly decode and display the picture, the receiver must identify the process used to encode the data.

The following code example shows part of a MIME header that indicates the content is a .gif file. It is then encoded using the standard base64 algorithm, and is treated by the e-mail client as an attachment.

Content-Type: image/gif;
   name="picture.gif"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
   filename="picture.gif"
  
[encoded content here]

Multipart Body Parts

The MIME message format defines several multipart content-types that describe the relationship of child body parts. For example, when a message contains both a US-ASCII text message and an attachment, the top-level body part content type is "multipart/mixed." Both the text and the attachment exist as child body parts. Another example is a multipart/alternative content type. This indicates alternative representations of a single message, for example in both US-ASCII text and HTML marked-up text.

For more information on Multipart Body Parts, see MIME Extensions to Internet Mail in the appendix.