IPP Mail Archive: IPP> NOT - Multipart MIME - The Whole Story - this time with TXT attac

IPP Mail Archive: IPP> NOT - Multipart MIME - The Whole Story - this time with TXT attac

IPP> NOT - Multipart MIME - The Whole Story - this time with TXT attac

Manros, Carl-Uno B (cmanros@cp10.es.xerox.com)
Tue, 10 Aug 1999 08:58:58 -0700

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

Content-Type: text/plain;


It turned out that my TXT attachment from yesterday was in fact a DOC

To be IETF politically correct, here the correct TXT version.


Carl-Uno Manros
Principal Engineer - Xerox Architecture Center - Xerox Corporation
701 S. Aviation Blvd., El Segundo, CA, M/S: ESAE-231
Phone +1-310-333 8273, Fax +1-310-333 5514
Email: manros@cp10.es.xerox.com

Content-Type: text/plain;
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;

2.b. A "multipart" Content-Type value, which can be
used to combine several body parts, possibly of
differing types of data, into a single message.

The term "body part", in this document, means one of the
parts of the body of a multipart entity. A body part has a
header and a body, so it makes sense to speak about the body
of a body part.

Note that the MIME-Version header field is required at the
top level of a message. It is not required for each body
part of a multipart entity. It is required for the embedded
headers of a body of type "message" if and only if the
embedded message is itself claimed to be MIME-compliant.

In general, the top-level Content-Type is used to declare
the general type of data, while the subtype specifies a
specific format for that type of data. Thus, a Content-Type
of "image/xyz" 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 "xyz". Such information can be used,
for example, to decide whether or not to show a user the raw
data from an unrecognized subtype -- such an action might be
reasonable for unrecognized subtypes of text, but not for
unrecognized subtypes of image or audio. For this reason,
registered subtypes of audio, image, text, and video, should
not contain embedded information that is really of a
different type. Such compound types should be represented
using the "multipart" or "application" types.

Parameters are modifiers of the content-subtype, and do not
fundamentally affect the requirements of the host system.
Although most parameters make sense only with certain
content-types, others are "global" in the sense that they
might apply to any subtype. For example, the "boundary"
parameter makes sense only for the "multipart" content-type,
but the "charset" parameter might make sense with several

multipart -- data consisting of multiple parts of
independent data types. Four initial subtypes
are defined, including the primary "mixed"
subtype, "alternative" for representing the same
data in multiple formats, "parallel" for parts
intended to be viewed simultaneously, and "digest"
for multipart entities in which each part is of
type "message".

7.2 The Multipart Content-Type

In the case of multiple part messages, in which one or more
different sets of data are combined in a single body, a
"multipart" Content-Type field must appear in the entity's
header. The body must then contain one or more "body parts,"
each preceded by an encapsulation boundary, and the last one
followed by a closing boundary. Each part starts with an
encapsulation boundary, and then contains a body part
consisting of header area, a blank line, and a body area.
Thus a body part is similar to an RFC 822 message in syntax,
but different in meaning.

A body part is NOT to be interpreted as actually being an
RFC 822 message. To begin with, NO header fields are
actually required in body parts. A body part that starts
with a blank line, therefore, is allowed and is a body part
for which all default values are to be assumed. In such a
case, the absence of a Content-Type header field implies
that the encapsulation is plain US-ASCII text. The only
header fields that have defined meaning for body parts are
those the names of which begin with "Content-". All other
header fields are generally to be ignored in body parts.
Although they should generally be retained in mail
processing, they may be discarded by gateways if necessary.
Such other fields are permitted to appear in body parts but
should not be depended on. "X-" fields may be created for
experimental or private purposes, with the recognition that
the information they contain may be lost at some gateways.

The distinction between an RFC 822 message and a body part
is subtle, but important. A gateway between Internet and
X.400 mail, for example, must be able to tell the difference
between a body part that contains an image and a body part
that contains an encapsulated message, the body of which is
an image. In order to represent the latter, the body part
must have "Content-Type: message", and its body (after the
blank line) must be the encapsulated message, with its own
"Content-Type: image" header field. The use of similar
syntax facilitates the conversion of messages to body parts,
and vice versa, but the distinction between the two must be
understood by implementors. (For the special case in which
all parts actually are messages, a "digest" subtype is also

As stated previously, each body part is preceded by an
encapsulation boundary. The encapsulation boundary MUST NOT
appear inside any of the encapsulated parts. Thus, it is
crucial that the composing agent be able to choose and
specify the unique boundary that will separate the parts.

All present and future subtypes of the "multipart" type must
use an identical syntax. Subtypes may differ in their
semantics, and may impose additional restrictions on syntax,
but must conform to the required syntax for the multipart
type. This requirement ensures that all conformant user
agents will at least be able to recognize and separate the
parts of any multipart entity, even of an unrecognized

As stated in the definition of the Content-Transfer-Encoding
field, no encoding other than "7bit", "8bit", or "binary" is
permitted for entities of type "multipart". The multipart
delimiters and header fields are always 7-bit ASCII in any
case, and data within the body parts can be encoded on a
part-by-part basis, with Content-Transfer-Encoding fields
for each appropriate body part.

Mail gateways, relays, and other mail handling agents are
commonly known to alter the top-level header of an RFC 822
message. In particular, they frequently add, remove, or
reorder header fields. Such alterations are explicitly
forbidden for the body part headers embedded in the bodies
of messages of type "multipart."

7.2.1 Multipart: The common syntax

All subtypes of "multipart" share a common syntax, defined
in this section. A simple example of a multipart message
also appears in this section. An example of a more complex
multipart message is given in Appendix C.

The Content-Type field for multipart entities requires one
parameter, "boundary", which is used to specify the
encapsulation boundary. The encapsulation boundary is
defined as a line consisting entirely of two hyphen
characters ("-", decimal code 45) followed by the boundary
parameter value from the Content-Type header field.

NOTE: The hyphens are for rough compatibility with the
earlier RFC 934 method of message encapsulation, and for
ease of searching for the boundaries in some
implementations. However, it should be noted that multipart
messages are NOT completely compatible with RFC 934
encapsulations; in particular, they do not obey RFC 934
quoting conventions for embedded lines that begin with
hyphens. This mechanism was chosen over the RFC 934
mechanism because the latter causes lines to grow with each
level of quoting. The combination of this growth with the
fact that SMTP implementations sometimes wrap long lines
made the RFC 934 mechanism unsuitable for use in the event
that deeply-nested multipart structuring is ever desired.

Thus, a typical multipart Content-Type header field might
look like this:

Content-Type: multipart/mixed;

This indicates that the entity consists of several parts,
each itself with a structure that is syntactically identical
to an RFC 822 message, except that the header area might be
completely empty, and that the parts are each preceded by
the line


Note that the encapsulation boundary must occur at the
beginning of a line, i.e., following a CRLF, and that that
initial CRLF is considered to be part of the encapsulation
boundary rather than part of the preceding part. The
boundary must be followed immediately either by another CRLF
and the header fields for the next part, or by two CRLFs, in
which case there are no header fields for the next part (and
it is therefore assumed to be of Content-Type text/plain).

NOTE: The CRLF preceding the encapsulation line is
considered part of the boundary so that it is possible to
have a part that does not end with a CRLF (line break).
Body parts that must be considered to end with line breaks,
therefore, should have two CRLFs preceding the encapsulation
line, the first of which is part of the preceding body part,
and the second of which is part of the encapsulation

The requirement that the encapsulation boundary begins with
a CRLF implies that the body of a multipart entity must
itself begin with a CRLF before the first encapsulation line
-- that is, if the "preamble" area is not used, the entity
headers must be followed by TWO CRLFs. This is indeed how
such entities should be composed. A tolerant mail reading
program, however, may interpret a body of type multipart
that begins with an encapsulation line NOT initiated by a
CRLF as also being an encapsulation boundary, but a
compliant mail sending program must not generate such

Encapsulation boundaries must not appear within the
encapsulations, and must be no longer than 70 characters,
not counting the two leading hyphens.

The encapsulation boundary following the last body part is a
distinguished delimiter that indicates that no further body
parts will follow. Such a delimiter is identical to the
previous delimiters, with the addition of two more hyphens
at the end of the line:


There appears to be room for additional information prior to
the first encapsulation boundary and following the final
boundary. These areas should generally be left blank, and
implementations should ignore anything that appears before
the first boundary or after the last one.

NOTE: These "preamble" and "epilogue" areas are not used
because of the lack of proper typing of these parts and the
lack of clear semantics for handling these areas at
gateways, particularly X.400 gateways.

NOTE: Because encapsulation boundaries must not appear in
the body parts being encapsulated, a user agent must
exercise care to choose a unique boundary. The boundary in
the example above could have been the result of an algorithm
designed to produce boundaries with a very low probability
of already existing in the data to be encapsulated without
having to prescan the data. Alternate algorithms might
result in more 'readable' boundaries for a recipient with an
old user agent, but would require more attention to the
possibility that the boundary might appear in the
encapsulated part. The simplest boundary possible is
something like "---", with a closing boundary of "-----".

As a very simple example, the following multipart message
has two parts, both of them plain text, one of them
explicitly typed and one of them implicitly typed:

From: Nathaniel Borenstein <nsb@bellcore.com>
To: Ned Freed <ned@innosoft.com>
Subject: Sample message
MIME-Version: 1.0
Content-type: multipart/mixed; boundary=3D"simple

This is the preamble. It is to be ignored, though it
is a handy place for mail composers to include an
explanatory note to non-MIME compliant readers.
--simple boundary

This is implicitly typed plain ASCII text.
It does NOT end with a linebreak.
--simple boundary
Content-type: text/plain; charset=3Dus-ascii

This is explicitly typed plain ASCII text.
It DOES end with a linebreak.

--simple boundary--
This is the epilogue. It is also to be ignored.

The use of a Content-Type of multipart in a body part within
another multipart entity is explicitly allowed. In such
cases, for obvious reasons, care must be taken to ensure
that each nested multipart entity must use a different
boundary delimiter. See Appendix C for an example of nested
multipart entities.

The use of the multipart Content-Type with only a single
body part may be useful in certain contexts, and is
explicitly permitted.

The only mandatory parameter for the multipart Content-Type
is the boundary parameter, which consists of 1 to 70
characters from a set of characters known to be very robust
through email gateways, and NOT ending with white space.
(If a boundary appears to end with white space, the white
space must be presumed to have been added by a gateway, and
should be deleted.) It is formally specified by the
following BNF:

boundary :=3D 0*69<bchars> bcharsnospace

bchars :=3D bcharsnospace / " "

bcharsnospace :=3D DIGIT / ALPHA / "'" / "(" / ")" / "+"/ =20
"_" / "," / "-" / "." / "/" / ":" / "=3D" / "?"

Overall, the body of a multipart entity may be specified as

multipart-body :=3D preamble 1*encapsulation
close-delimiter epilogue

encapsulation :=3D delimiter CRLF body-part

delimiter :=3D CRLF "--" boundary=20
; taken from Content-Type field.
; when content-type is multipart
; There must be no space
; between "--" and boundary.

close-delimiter :=3D delimiter "--" ; Again, no space =

preamble :=3D *text ; to be ignored upon receipt.

epilogue :=3D *text ; to be ignored upon receipt.

body-part =3D <"message" as defined in RFC 822,
with all header fields optional, and with the
specified delimiter not occurring anywhere in
the message body, either on a line by itself
or as a substring anywhere. Note that the
semantics of a part differ from the semantics
of a message, as described in the text.>

NOTE: Conspicuously missing from the multipart type is a
notion of structured, related body parts. In general, it
seems premature to try to standardize interpart structure
yet. It is recommended that those wishing to provide a more
structured or integrated multipart messaging facility should
define a subtype of multipart that is syntactically
identical, but that always expects the inclusion of a
distinguished part that can be used to specify the structure
and integration of the other parts, probably referring to
them by their Content-ID field. If this approach is used,
other implementations will not recognize the new subtype,
but will treat it as the primary subtype (multipart/mixed)
and will thus be able to show the user the parts that are

7.2.2 The Multipart/mixed (primary) subtype

The primary subtype for multipart, "mixed", is intended for
use when the body parts are independent and intended to be
displayed serially. Any multipart subtypes that an
implementation does not recognize should be treated as being
of subtype "mixed".

7.2.3 The Multipart/alternative subtype

The multipart/alternative type is syntactically identical to
multipart/mixed, but the semantics are different. In
particular, each of the parts is an "alternative" version of
the same information. User agents should recognize that the
content of the various parts are interchangeable. The user
agent should either choose the "best" type based on the
user's environment and preferences, or offer the user the
available alternatives. In general, choosing the best type
means displaying only the LAST part that can be displayed.
This may be used, for example, to send mail in a fancy text
format in such a way that it can easily be displayed

From: Nathaniel Borenstein <nsb@bellcore.com>
To: Ned Freed <ned@innosoft.com>
Subject: Formatted text mail
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary=3Dboundary42

Content-Type: text/plain; charset=3Dus-ascii

...plain text version of message goes here....

Content-Type: text/richtext

.... richtext version of same message goes here ...
Content-Type: text/x-whatever

... fanciest formatted version of same message goes here

In this example, users whose mail system understood the
"text/x-whatever" format would see only the fancy version,
while other users would see only the richtext or plain text
version, depending on the capabilities of their system.

In general, user agents that compose multipart/alternative
entities should place the body parts in increasing order of
preference, that is, with the preferred format last. For
fancy text, the sending user agent should put the plainest
format first and the richest format last. Receiving user
agents should pick and display the last format they are
capable of displaying. In the case where one of the
alternatives is itself of type "multipart" and contains
unrecognized sub-parts, the user agent may choose either to
show that alternative, an earlier alternative, or both.

NOTE: From an implementor's perspective, it might seem more
sensible to reverse this ordering, and have the plainest
alternative last. However, placing the plainest alternative
first is the friendliest possible option when
multipart/alternative entities are viewed using a non-MIME-
compliant mail reader. While this approach does impose some
burden on compliant mail readers, interoperability with
older mail readers was deemed to be more important in this

It may be the case that some user agents, if they can
recognize more than one of the formats, will prefer to offer
the user the choice of which format to view. This makes
sense, for example, if mail includes both a nicely-formatted
image version and an easily-edited text version. What is
most critical, however, is that the user not automatically
be shown multiple versions of the same data. Either the
user should be shown the last recognized version or should
explicitly be given the choice.

7.2.4 The Multipart/digest subtype

This document defines a "digest" subtype of the multipart
Content-Type. This type is syntactically identical to
multipart/mixed, but the semantics are different. In
particular, in a digest, the default Content-Type value for
a body part is changed from "text/plain" to
"message/rfc822". This is done to allow a more readable
digest format that is largely compatible (except for the
quoting convention) with RFC 934.

A digest in this format might, then, look something like

From: Moderator-Address
MIME-Version: 1.0
Subject: Internet Digest, volume 42
Content-Type: multipart/digest;
boundary=3D"---- next message ----"

------ next message ----

From: someone-else
Subject: my opinion

...body goes here ...

------ next message ----

From: someone-else-again
Subject: my different opinion

... another body goes here...

------ next message ------

7.2.5 The Multipart/parallel subtype

This document defines a "parallel" subtype of the multipart
Content-Type. This type is syntactically identical to
multipart/mixed, but the semantics are different. In
particular, in a parallel entity, all of the parts are
intended to be presented in parallel, i.e., simultaneously,
on hardware and software that are capable of doing so.
Composing agents should be aware that many mail readers will
lack this capability and will show the parts serially in any

Appendix C -- A Complex Multipart Example

What follows is the outline of a complex multipart message.
This message has five parts to be displayed serially: two
introductory plain text parts, an embedded multipart
message, a richtext part, and a closing encapsulated text
message in a non-ASCII character set. The embedded
multipart message has two parts to be displayed in parallel,
a picture and an audio fragment.

MIME-Version: 1.0
From: Nathaniel Borenstein <nsb@bellcore.com>
Subject: A multipart example
Content-Type: multipart/mixed;

This is the preamble area of a multipart message.
Mail readers that understand multipart format
should ignore this preamble.
If you are reading this text, you might want to
consider changing to a mail reader that understands
how to properly display multipart messages.

...Some text appears here...
[Note that the preceding blank line means
no header fields were given and this is text,
with charset US ASCII. It could have been
done with explicit typing as in the next part.]

Content-type: text/plain; charset=3DUS-ASCII

This could have been part of the previous part,
but illustrates explicit versus implicit
typing of body parts.

Content-Type: multipart/parallel;

Content-Type: audio/basic
Content-Transfer-Encoding: base64

... base64-encoded 8000 Hz single-channel
u-law-format audio data goes here....

Content-Type: image/gif
Content-Transfer-Encoding: Base64

... base64-encoded image data goes here....


Content-type: text/richtext

This is <bold><italic>richtext.</italic></bold>
<nl><nl>Isn't it

Content-Type: message/rfc822

From: (name in US-ASCII)
Subject: (subject in US-ASCII)
Content-Type: Text/plain; charset=3DISO-8859-1
Content-Transfer-Encoding: Quoted-printable

... Additional text in ISO-8859-1 goes here ...


1. The Multipart/Report MIME content-type

The Multipart/Report MIME content-type is a general "family" or
"container" type for electronic mail reports of any kind. Although
this memo defines only the use of the Multipart/Report content-type
with respect to delivery status reports, mail processing programs
will benefit if a single content-type is used to for all kinds of

The Multipart/Report content-type is defined as follows:

MIME type name: multipart
MIME subtype name: report
Required parameters: boundary, report-type
Optional parameters: none
Encoding considerations: 7bit should always be adequate
Security considerations: see section 4 of this memo.

The syntax of Multipart/Report is identical to the Multipart/Mixed
content type defined in [MIME]. When used to send a report, the
Multipart/Report content-type must be the top-level MIME content
type for any report message. The report-type parameter identifies
the type of report. The parameter is the MIME content sub-type of
the second body part of the Multipart/Report.

User agents and gateways must be able to automatically determine
that a message is a mail system report and should be processed as
such. Placing the Multipart/Report as the outermost content
provides a mechanism whereby an auto-processor may detect through
parsing the RFC 822 headers that the message is a report.

The Multipart/Report content-type contains either two or three sub-
parts, in the following order:

(1) [required] The first body part contains human readable message.
The purpose of this message is to provide an easily-understood
description of the condition(s) that caused the report to be
generated, for a human reader who may not have an user agent
capable of interpreting the second section of the

The text in the first section may be in any MIME standards-track
content-type, charset, or language. Where a description of the
error is desired in several languages or several media, a
Multipart/Alternative construct may be used.

This body part may also be used to send detailed information
that cannot be easily formatted into a Message/Report body part.

(2) [required] A machine parsable body part containing an account
of the reported message handling event. The purpose of this body
part is to provide a machine-readable description of the
condition(s) which caused the report to be generated, along with
details not present in the first body part that may be useful to
human experts. An initial body part, Message/delivery-status is
defined in [DSN]

(3) [optional] A body part containing the returned message or a
portion thereof. This information may be useful to aid human
experts in diagnosing problems. (Although it may also be useful
to allow the sender to identify the message which the report was
issued, it is hoped that the envelope-id and original-recipient-
address returned in the Message/Report body part will replace
the traditional use of the returned content for this purpose.)

Return of content may be wasteful of network bandwidth and a variety
of implementation strategies can be used. Generally the sender
should choose the appropriate strategy and inform the recipient of
the required level of returned content required. In the absence of
an explicit request for level of return of content such as that
provided in [DRPT], the agent which generated the delivery service
report should return the full message content.

When data not encoded in 7 bits is to be returned, and the return
path is not guaranteed to be 8-bit capable, two options are
available. The original message MAY be reencoded into a legal 7
bit MIME message or the Text/RFC822-Headers content-type MAY be used
to return only the original message headers.

1. Introduction

Several applications of MIME, including MIME-PEM, and MIME-Macintosh
and other proposals, require multiple body parts that make sense
only in the aggregate. The present approach to these compound
objects has been to define specific multipart subtypes for each new
object. In keeping with the MIME philosophy of having one mechanism
to achieve the same goal for different purposes, this document
describes a single mechanism for such aggregate or compound objects.

The Multipart/Related content-type addresses the MIME representation
of compound objects. The object is categorized by a "type"
parameter. Additional parameters are provided to indicate a
specific starting body part or root and auxiliary information which
may be required when unpacking or processing the object.

Multipart/Related MIME entities may contain Content-Disposition
headers that provide suggestions for the storage and display of a
body part. Multipart/Related processing takes precedence over
Content-Disposition; the interaction between them is discussed in
section 4.

Responsibility for the display or processing of a
Multipart/Related's constituent entities rests with the application
that handles the compound object.

2. Multipart/Related Registration Information

The following form is copied from RFC 1590, Appendix A.

To: IANA@isi.edu
Subject: Registration of new Media Type content-type/subtype

Media Type name: Multipart

Media subtype name: Related

Required parameters: Type, a media type/subtype.

Optional parameters: Start

Encoding considerations: Multipart content-types cannot have

Security considerations: Depends solely on the referenced type.

Published specification: RFC-REL (this document).

Person & email address to contact for further information:
Edward Levinson
47 Clive Street
Metuchen, NJ 08840-1060
+1 908 494 1606

3. Intended usage

The Multipart/Related media type is intended for compound objects
consisting of several inter-related body parts. For a
Multipart/Related object, proper display cannot be achieved by
individually displaying the constituent body parts. The content-
type of the Multipart/Related object is specified by the type
The "start" parameter, if given, points, via a content-ID, to the
body part that contains the object root. The default root is the
first body part within the Multipart/Related body.

The relationships among the body parts of a compound object
distinguishes it from other object types. These relationships are
often represented by links internal to the object's components that
reference the other components. Within a single operating
environment the links are often file names, such links may be
represented within a MIME message using content-IDs or the value of
some other "Content-" headers.

3.1. The Type Parameter

The type parameter must be specified and its value is the MIME media
type of the "root" body part. It permits a MIME user agent to
determine the content-type without reference to the enclosed body
part. If the value of the type parameter and the root body part's
content-type differ then the User Agent's behavior is undefined.

3.2. The Start Parameter

The start parameter, if given, is the content-ID of the compound
object's "root". If not present the "root" is the first body part
in the Multipart/Related entity. The "root" is the element the
applications processes first.

3.3. The Start-Info Parameter

Additional information can be provided to an application by the
start-info parameter. It contains either a string or points, via a
content-ID, to another MIME entity in the message. A typical use
might be to provide additional command line parameters or a MIME
entity giving auxiliary information for processing the compound

Applications that use Multipart/Related must specify the
interpretation of start-info. User Agents shall provide the
parameter's value to the processing application. Processes can
distinguish a start-info reference from a token or quoted-string by
examining the first non-white-space character, "<" indicates a

3.4. Syntax

related-param :=3D [ ";" "start" "=3D" cid ]
[ ";" "start-info" "=3D"
( cid-list / value ) ]
[ ";" "type" "=3D" type "/" subtype ]
; order independent

cid-list :=3D cid cid-list

cid :=3D msg-id ; c.f. [822]

value :=3D token / quoted-string ; c.f. [MIME]
; value cannot begin with "<"

Note that the parameter values will usually require quoting. Msg-id
contains the special characters "<", ">", "@", and perhaps other
special characters. If msg-id contains quoted-strings, those quote
marks must be escaped. Similarly, the type parameter contains the
special character "/".

4. Handling Content-Disposition Headers

Content-Disposition Headers [DISP] suggest presentation styles for
MIME body parts. [DISP] describes two presentation styles, called
the disposition type, INLINE and ATTACHMENT. These, used within a
multipart entity, allow the sender to suggest presentation
information. [DISP] also provides for an optional storage (file)
name. Content-Disposition headers could appear in one or more body
parts contained within a Multipart/Related entity.

Using Content-Disposition headers in addition to Multipart/Related
provides presentation information to User Agents that do not
recognize Multipart/Related. They will treat the multipart as
Multipart/Mixed and they may find the Content-Disposition
information useful.

With Multipart/Related however, the application processing the
compound object determines the presentation style for all the
contained parts. In that context the Content-Disposition header
information is redundant or even misleading. Hence, User Agents
that understand Multipart/Related shall ignore the disposition type
within a Multipart/Related body part.

It may be possible for a User Agent capable of handling both
Multipart/Related and Content-Disposition headers to provide the
invoked application the Content-Disposition header's optional
filename parameter to the Multipart/Related. The use of that
information will depend on the specific application and should be
specified when describing the handling of the corresponding compound
object. Such descriptions would be appropriate in an RFC
registering that object's media type.