The TCP/IP Guide - Version 3.0 (Contents) ` 1412 _ © 2001-2005 Charles M. Kozierok. All Rights Reserved.
☯ multipart/mixed: Indicates that the body parts are not really related, but have just
been bundled for transport in a single message for convenience. For example, this
might be used by someone to send an office memo along with a vacation snapshot
just for fun. This subtype is also used sometimes when the parts are related but the
relationship is communicated to the recipient in some other way (such as a description
in a distinct body part).
☯ multipart/alternative: Specifies that the body parts are alternative representations of
the same information. The recipient decodes the parts and chooses the one that is
best suited to his or her needs. A common use of this is in sending HTML-encoded e-
mail. Some e-mail clients can't display HTML, so it is courteous to send a multipart/
alternative message containing the message in both HTML and plain text forms.
The alternatives should be placed in the message in increasing order of preference,
meaning that the preferred format goes last. In the case of a document that includes
plain text and rich text alternatives—such as the example above with plain text and
HTML versions of a document—the plainest format should go first and the “fanciest”
last.
☯ multipart/parallel: Tells the recipient that the body parts should all be displayed at the
same time (“in parallel”). One example of how this might be used would be if someone
sent an audio clip along with explanatory text to be displayed alongside it as it played.
☯ multipart/digest: This is used to allow a message to carry a digest, such as a
collection of other e-mail messages.
☯ multipart/related: Indicates specifically that the body parts are related to each other.
Special parameters are used to provide more information on how they are to be inter-
preted. This subtype was defined in RFC 2387.
☯ multipart/encrypted: Used for encrypted data. The first body part contains infor-
mation on how the data is to be decrypted, and the second contains the data itself.
This subtype was defined in RFC 1847.
Multipart Message Encoding
You can see just from these different subtypes how much flexibility the multipart type
provides to MIME, and there are others. In all cases, the same syntax is used to encode the
constituent body parts into a single message. The basic process is as follows:
1. Each individual piece of data is processed as if it were to be transmitted as the body of
a discrete media type MIME message. This includes the specification of appropriate
headers, such as Content-Type, Content-ID and Content-Transfer-Encoding, as
needed.
2. A special boundary delimiter is chosen to separate the body parts. It must be selected
so that it will not appear in any of the body parts; a random string is sometimes used. It
is prepended with two dashes (“--”) when placed in the message to reduce the chance
of it being mistaken for data.
3. The multipart message is assembled. It consists of a preamble text area, then a
boundary line, followed by the first body part. Each subsequent body part is separated
from the previous one with another boundary line. After the last body part, another
boundary line appears, followed by an epilogue text area.