RFC 2112 PROPOSED STANDARD MIME · EMAIL · WEB

The MIME Multipart/Related Content-type

A standard way to send related documents together, like HTML with its images.

On rfc-editor.org ↗
PUBLISHED
March 1997
AUTHORS
E. Levinson
STREAM
IETF
BUILDS ON
RFC 1872 — MIME Multipart/Related
OBSOLETED BY
RFC 2387 — multipart/related
REQUIRED PARAMETER
type (MIME media type)
OPTIONAL PARAMETERS
start, start-info
PART REFERENCES
content-ID based URLs (cid:)
PROCESSING
Application-specific
DOI
10.17487/RFC2112

RFC text

Contents
Original text · RFC Editor View on rfc-editor.org ↗
Network Working Group                                        E. Levinson
Request for Comments: 2112                                   XIson, Inc.
Category: Standards Track                                     March 1997
Obsoletes: 1872


                The MIME Multipart/Related Content-type

Status of this Memo

   This document specifies an Internet standards track protocol for the
   Internet community, and requests discussion and suggestions for
   improvements.  Please refer to the current edition of the "Internet
   Official Protocol Standards" (STD 1) for the standardization state
   and status of this protocol.  Distribution of this memo is unlimited.

Abstract

   The Multipart/Related content-type provides a common mechanism for
   representing objects that are aggregates of related MIME body parts.
   This document defines the Multipart/Related content-type and provides
   examples of its use.

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
                     Start-info

   Encoding considerations:   Multipart content-types cannot have
                              encodings.

   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
                     XIson@cnj.digex.net

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 parameter.
   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
   object.

   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
   reference.

3.4.  Syntax

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

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

     value           := 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.

5.  Examples

5.1 Application/X-FixedRecord

   The X-FixedRecord content-type consists of one or more octet-streams
   and a list of the lengths of each record.  The root, which lists the
   record lengths of each record within the streams.  The record length
   list, type Application/X-FixedRecord, consists of a set of INTEGERs
   in ASCII format, one per line.  Each INTEGER gives the number of
   octets from the octet-stream body part that constitute the next
   "record".

   The example below, uses a single data block.

     Content-Type: Multipart/Related; boundary=example-1
             start="<950120.aaCC@XIson.com>";
             type="Application/X-FixedRecord"
          start-info="-o ps"

     --example-1
     Content-Type: Application/X-FixedRecord
     Content-ID: <950120.aaCC@XIson.com>

     25
     10
     34
     10
     25
     21
     26
     10
     --example-1
     Content-Type: Application/octet-stream
     Content-Description: The fixed length records
     Content-Transfer-Encoding: base64
     Content-ID: <950120.aaCB@XIson.com>

     T2xkIE1hY0RvbmFsZCBoYWQgYSBmYXJtCkUgSS
     BFIEkgTwpBbmQgb24gaGlzIGZhcm0gaGUgaGFk
     IHNvbWUgZHVja3MKRSBJIEUgSSBPCldpdGggYS
     BxdWFjayBxdWFjayBoZXJlLAphIHF1YWNrIHF1
     YWNrIHRoZXJlLApldmVyeSB3aGVyZSBhIHF1YW
     NrIHF1YWNrCkUgSSBFIEkgTwo=

     --example-1--

5.2 Text/X-Okie

   The Text/X-Okie is an invented markup language permitting the
   inclusion of images with text.  A feature of this example is the
   inclusion of two additional body parts, both picture. They are
   referred to internally by the encapsulated document via each
   picture's body part content-ID.  Usage of "cid:", as in this example,
   may be useful for a variety of compound objects.  It is not, however,
   a part of the Multipart/Related specification.

     Content-Type: Multipart/Related; boundary=example-2;
             start="<950118.AEBH@XIson.com>"
          type="Text/x-Okie"

     --example-2
     Content-Type: Text/x-Okie; charset=iso-8859-1;
             declaration="<950118.AEB0@XIson.com>"
     Content-ID: <950118.AEBH@XIson.com>
     Content-Description: Document

     {doc}
     This picture was taken by an automatic camera mounted ...
     {image file=cid:<950118.AECB@XIson.com>}
     {para}
     Now this is an enlargement of the area ...
     {image file=cid:<950118:AFDH@XIson.com>}
     {/doc}
     --example-2
     Content-Type: image/jpeg
     Content-ID: <950118.AFDH@XIson.com>
     Content-Transfer-Encoding: BASE64
     Content-Description: Picture A

     [encoded jpeg image]
     --example-2
     Content-Type: image/jpeg
     Content-ID: <950118.AECB@XIson.com>
     Content-Transfer-Encoding: BASE64
     Content-Description: Picture B

     [encoded jpeg image]
     --example-2--

5.3 Content-Disposition

   In the above example each image body part could also have a Content-
   Disposition header.  For example,

     ...
     --example-2
     Content-Type: image/jpeg
     Content-ID: <950118.AECB@XIson.com>
     Content-Transfer-Encoding: BASE64
     Content-Description: Picture B
     Content-Disposition: INLINE

     [encoded jpeg image]
     --example-2--

   User Agents that recognize Multipart/Related will ignore the
   Content-Disposition header's disposition type.  Other User Agents
   will process the Multipart/Related as Multipart/Mixed and may make
   use of that header's information.

6.  User Agent Requirements

   User agents that do not recognize Multipart/Related shall, in
   accordance with [MIME], treat the entire entity as Multipart/Mixed.
   MIME User Agents that do recognize Multipart/Related entities but are
   unable to process the given type should give the user the option of
   suppressing the entire Multipart/Related body part shall be.

   Existing MIME-capable mail user agents (MUAs) handle the existing
   media types in a straightforward manner.  For discrete media types
   (e.g. text, image, etc.) the body of the entity can be directly
   passed to a display process.  Similarly the existing composite
   subtypes can be reduced to handing one or more discrete types.
   Handling Multipart/Related differs in that processing cannot be
   reduced to handling the individual entities.

   The following sections discuss what information the processing
   application requires.

   It is possible that an application specific "receiving agent" will
   manipulate the entities for display prior to invoking actual
   application process.  Okie, above, is an example of this; it may need
   a receiving agent to parse the document and substitute local file
   names for the originator's file names.  Other applications may just
   require a table showing the correspondence between the local file
   names and the originator's.  The receiving agent takes responsibility
   for such processing.

6.1 Data Requirements

   MIME-capable mail user agents (MUAs) are required to provide the
   application:

   (a)  the bodies of the MIME entities and the entity Content-*
        headers,

   (b)  the parameters of the Multipart/Related Content-type
        header, and

   (c)  the correspondence between each body's local file name,
        that body's header data, and, if present, the body part's
        content-ID.

6.2 Storing Multipart/Related Entities

   The Multipart/Related media type will be used for objects that have
   internal linkages between the body parts.  When the objects are
   stored the linkages may require processing by the application or its
   receiving agent.

6.3 Recursion

   MIME is a recursive structure.  Hence one must expect a
   Multipart/Related entity to contain other Multipart/Related entities.
   When a Multipart/Related entity is being processed for display or
   storage, any enclosed Multipart/Related entities shall be processed
   as though they were being stored.

6.4 Configuration Considerations

   It is suggested that MUAs that use configuration mechanisms, see
   [CFG] for an example, refer to Multipart/Related as
   Multipart/Related/<type>, were <type> is the value of the "type"
   parameter.

7.  Security considerations

   Security considerations relevant to Multipart/Related are identical
   to those of the underlying content-type.

8.  Acknowledgments

   This proposal is the result of conversations the author has had with
   many people.  In particular, Harald A. Alvestrand, James Clark,
   Charles Goldfarb, Gary Houston, Ned Freed, Ray Moody, and Don
   Stinchfield, provided both encouragement and invaluable help.  The
   author, however, take full responsibility for all errors contained in
   this document.

9.  References

   [822]       Crocker, D., "Standard for the Format of ARPA
               Internet Text Messages", August 1982, University
               of Delaware, RFC 822.

   [CID]       E. Levinson, J. Clark, "Message/External-Body
               Content-ID Access Type", 12/26/1995, RFC 1873
               Levinson, E., "Message/External-Body Content-ID
               Access Type", February 1997, RFC 2111.

   [CFG]       Borenstein, N., "A User Agent Configuration
               Mechanism For Multimedia Mail Format
               Information", September 23, 1993, RFC 1524

   [DISP]      R. Troost, S. Dorner, "Communicating Presentation
               Information in Internet Messages:  The Content-
               Disposition Header", June 7, 1995, RFC 1806

   [MIME]      Borenstein, N. and Freed, N., "MIME (Multipurpose
               Internet Mail Extensions): Mechanisms for
               Specifying and Describing the Format of Internet
               Message Bodies", June 1992, RFC 1341.

9.  Author's Address

   Edward Levinson
   XIson, Inc.
   47 Clive Street
   Metuchen, NJ  08840-1060
   USA
   +1 908 549 3716
   <XIson@cnj.digex.com>

AI ELI5

On this page
PROBLEMEmail and document systems need a standard way to represent a compound object made of several pieces that reference each other, such as a web page with embedded images.
MECHANISMMultipart/Related defines a MIME container with a type parameter (the media type of the root), a start parameter (pointing to the main part), and optional start-info (auxiliary data), allowing all parts to be packaged and transmitted as a single entity.
WHY IT MATTERSAuthors can reliably send structured documents with embedded resources without ambiguity about which part is the root or how parts relate; it was later refined by RFC 2387.

§1Introduction

RFC 2112 defines the Multipart/Related MIME content-type, a mechanism for representing compound objects made of multiple inter-related body parts. Such objects include web pages with embedded images, spreadsheets with external references, or other documents where the constituent parts make sense only together.

The RFC addresses a practical problem: earlier MIME specifications either lacked a general mechanism for such aggregates or required a new specific subtype for each new kind of compound object. Multipart/Related provides a single, reusable framework where the type parameter specifies what kind of object is being transmitted, and the start parameter designates the root part.

When you want to send an HTML page with its images as one package, you need a standard way to say 'these parts belong together' and 'start with this part first'. This standard provides that.

§2The Multipart/Related Structure

A Multipart/Related message consists of a container with required and optional parameters followed by multiple body parts.

The type parameter is mandatory and specifies the MIME media type of the root part (for example, text/html or application/xhtml+xml). This lets the recipient determine the object type without inspecting the enclosed parts.

The start parameter optionally points to a content-ID identifying the root part—the part the application should process first. If start is not given, the first body part in the message is the root.

The start-info parameter provides auxiliary information that may be needed when unpacking or processing the object, such as command-line options or references to another body part. Its interpretation depends on the application.

You label the container with what type of object it is. You tell it which part is the main one (by default it's the first). You can include extra instructions for how to process it.

§3Body Part Relationships

Within a Multipart/Related structure, body parts reference each other using content-IDs. A content-ID is a unique identifier assigned to each part that other parts can reference via URLs of the form cid:<content-id>.

For example, an HTML document might include <img src='cid:<picture@example.com>'> to reference an image body part. This approach keeps all related resources within the same message and avoids external URL lookups.

Multipart/Related processing takes precedence over Content-Disposition headers (which suggest inline or attachment handling). A Multipart/Related-aware application controls the presentation and ignores disposition hints, since the compound object's internal structure already defines how parts relate.

Each part gets an ID number. Parts can say 'show me the picture with ID 42' by referencing that ID. The application knows how to arrange them all together, so it ignores old-style 'show inline' hints.

§4Usage Examples

One common use is sending an HTML document with embedded images. The root part contains markup that references image parts by content-ID. An X-Okie example in the RFC shows a text/x-Okie document with two images referenced by cid: URLs, all packaged together so a mail client can display the complete document without fetching external resources.

Another example is a fixed-record format document: the root part (type application/x-FixedRecord) contains record lengths as ASCII text, and a separate body part contains binary data. The record lengths tell the application how to parse the binary part.

The RFC notes that such objects may be stored locally, and when stored, the receiving application or a specialized receiving agent may need to convert the content-ID references to local file names or process the parts in other application-specific ways.

You could send a website as one email: the HTML file says 'include my picture ID 1, my style sheet ID 2, etc.' and all those pieces come with it. Or you could send a data file with a separate record-length table.

§5User Agent Handling

Mail user agents that recognize Multipart/Related must gather all constituent parts, identify the root (using the start parameter or defaulting to the first part), and pass all parts to the application that handles the object's type.

Critically, the application—not the mail client—is responsible for interpreting the relationships and rendering or processing the compound object. The mail client's job is to extract and deliver the parts intact.

Agents that do not recognize Multipart/Related should treat it as Multipart/Mixed (a simple collection of parts) for compatibility. This graceful degradation ensures that older systems can at least access individual parts, even if they cannot reconstruct the compound object correctly.

A modern email client reads 'this is Multipart/Related' and passes all the pieces to the application that knows how to use them. An old client doesn't understand and just shows them as separate attachments.

§6Security Considerations

RFC 2112 states that security considerations for Multipart/Related are identical to those of the underlying content-type. The Multipart/Related wrapper itself does not introduce new security risks or guarantees.

Security implications depend on the type of the root part: a text/html document may be vulnerable to script injection, while a proprietary binary format may have its own parsing risks. Applications must validate and safely process the contained parts according to the security model of their type.

If you trust the HTML format, you trust Multipart/Related HTML. If you don't trust the binary format inside, Multipart/Related doesn't change that. Security depends on what the actual content is.

§7References