home *** CD-ROM | disk | FTP | other *** search
/ Magazyn WWW 1998 October / www_10_1998.iso / info / ogonki / rfc1521.txt < prev    next >
Text File  |  1998-09-09  |  187KB  |  4,539 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                      N. Borenstein
  8. Request for Comments: 1521                                      Bellcore
  9. Obsoletes: 1341                                                 N. Freed
  10. Category: Standards Track                                       Innosoft
  11.                                                           September 1993
  12.  
  13.  
  14.          MIME (Multipurpose Internet Mail Extensions) Part One:
  15.                 Mechanisms for Specifying and Describing
  16.                  the Format of Internet Message Bodies
  17.  
  18. Status of this Memo
  19.  
  20.    This RFC specifies an Internet standards track protocol for the
  21.    Internet community, and requests discussion and suggestions for
  22.    improvements.  Please refer to the current edition of the "Internet
  23.    Official Protocol Standards" for the standardization state and status
  24.    of this protocol.  Distribution of this memo is unlimited.
  25.  
  26. Abstract
  27.  
  28.    STD 11, RFC 822 defines a message representation protocol which
  29.    specifies considerable detail about message headers, but which leaves
  30.    the message content, or message body, as flat ASCII text.  This
  31.    document redefines the format of message bodies to allow multi-part
  32.    textual and non-textual message bodies to be represented and
  33.    exchanged without loss of information.  This is based on earlier work
  34.    documented in RFC 934 and STD 11, RFC 1049, but extends and revises
  35.    that work.  Because RFC 822 said so little about message bodies, this
  36.    document is largely orthogonal to (rather than a revision of) RFC
  37.    822.
  38.  
  39.    In particular, this document is designed to provide facilities to
  40.    include multiple objects in a single message, to represent body text
  41.    in character sets other than US-ASCII, to represent formatted multi-
  42.    font text messages, to represent non-textual material such as images
  43.    and audio fragments, and generally to facilitate later extensions
  44.    defining new types of Internet mail for use by cooperating mail
  45.    agents.
  46.  
  47.    This document does NOT extend Internet mail header fields to permit
  48.    anything other than US-ASCII text data.  Such extensions are the
  49.    subject of a companion document [RFC-1522].
  50.  
  51.    This document is a revision of RFC 1341.  Significant differences
  52.    from RFC 1341 are summarized in Appendix H.
  53.  
  54.  
  55.  
  56.  
  57.  
  58. Borenstein & Freed                                              [Page 1]
  59.  
  60. RFC 1521                          MIME                    September 1993
  61.  
  62.  
  63. Table of Contents
  64.  
  65.    1.     Introduction.......................................  3
  66.    2.     Notations, Conventions, and Generic BNF Grammar....  6
  67.    3.     The MIME-Version Header Field......................  7
  68.    4.     The Content-Type Header Field......................  9
  69.    5.     The Content-Transfer-Encoding Header Field......... 13
  70.    5.1.   Quoted-Printable Content-Transfer-Encoding......... 18
  71.    5.2.   Base64 Content-Transfer-Encoding................... 21
  72.    6.     Additional Content-Header Fields................... 23
  73.    6.1.   Optional Content-ID Header Field................... 23
  74.    6.2.   Optional Content-Description Header Field.......... 24
  75.    7.     The Predefined Content-Type Values................. 24
  76.    7.1.   The Text Content-Type.............................. 24
  77.    7.1.1. The charset parameter.............................. 25
  78.    7.1.2. The Text/plain subtype............................. 28
  79.    7.2.   The Multipart Content-Type......................... 28
  80.    7.2.1. Multipart:  The common syntax...................... 29
  81.    7.2.2. The Multipart/mixed (primary) subtype.............. 34
  82.    7.2.3. The Multipart/alternative subtype.................. 34
  83.    7.2.4. The Multipart/digest subtype....................... 36
  84.    7.2.5. The Multipart/parallel subtype..................... 37
  85.    7.2.6. Other Multipart subtypes........................... 37
  86.    7.3.   The Message Content-Type........................... 38
  87.    7.3.1. The Message/rfc822 (primary) subtype............... 38
  88.    7.3.2. The Message/Partial subtype........................ 39
  89.    7.3.3. The Message/External-Body subtype.................. 42
  90.    7.3.3.1.  The "ftp" and "tftp" access-types............... 44
  91.    7.3.3.2.  The "anon-ftp" access-type...................... 45
  92.    7.3.3.3.  The "local-file" and "afs" access-types......... 45
  93.    7.3.3.4.  The "mail-server" access-type................... 45
  94.    7.3.3.5.  Examples and Further Explanations............... 46
  95.    7.4.   The Application Content-Type....................... 49
  96.    7.4.1. The Application/Octet-Stream (primary) subtype..... 50
  97.    7.4.2. The Application/PostScript subtype................. 50
  98.    7.4.3. Other Application subtypes......................... 53
  99.    7.5.   The Image Content-Type............................. 53
  100.    7.6.   The Audio Content-Type............................. 54
  101.    7.7.   The Video Content-Type............................. 54
  102.    7.8.   Experimental Content-Type Values................... 54
  103.    8.     Summary............................................ 56
  104.    9.     Security Considerations............................ 56
  105.    10.    Authors' Addresses................................. 57
  106.    11.    Acknowledgements................................... 58
  107.    Appendix A -- Minimal MIME-Conformance.................... 60
  108.    Appendix B -- General Guidelines For Sending Email Data... 63
  109.    Appendix C -- A Complex Multipart Example................. 66
  110.    Appendix D -- Collected Grammar........................... 68
  111.  
  112.  
  113.  
  114. Borenstein & Freed                                              [Page 2]
  115.  
  116. RFC 1521                          MIME                    September 1993
  117.  
  118.  
  119.    Appendix E -- IANA Registration Procedures................ 72
  120.    E.1  Registration of New Content-type/subtype Values...... 72
  121.    E.2  Registration of New Access-type Values
  122.         for Message/external-body............................ 73
  123.    Appendix F -- Summary of the Seven Content-types.......... 74
  124.    Appendix G -- Canonical Encoding Model.................... 76
  125.    Appendix H -- Changes from RFC 1341....................... 78
  126.    References................................................ 80
  127.  
  128. 1.    Introduction
  129.  
  130.    Since its publication in 1982, STD 11, RFC 822 [RFC-822] has defined
  131.    the standard format of textual mail messages on the Internet.  Its
  132.    success has been such that the RFC 822 format has been adopted,
  133.    wholly or partially, well beyond the confines of the Internet and the
  134.    Internet SMTP transport defined by STD 10, RFC 821 [RFC-821].  As the
  135.    format has seen wider use, a number of limitations have proven
  136.    increasingly restrictive for the user community.
  137.  
  138.    RFC 822 was intended to specify a format for text messages.  As such,
  139.    non-text messages, such as multimedia messages that might include
  140.    audio or images, are simply not mentioned.  Even in the case of text,
  141.    however, RFC 822 is inadequate for the needs of mail users whose
  142.    languages require the use of character sets richer than US ASCII
  143.    [US-ASCII]. Since RFC 822 does not specify mechanisms for mail
  144.    containing audio, video, Asian language text, or even text in most
  145.    European languages, additional specifications are needed.
  146.  
  147.    One of the notable limitations of RFC 821/822 based mail systems is
  148.    the fact that they limit the contents of electronic mail messages to
  149.    relatively short lines of seven-bit ASCII.  This forces users to
  150.    convert any non-textual data that they may wish to send into seven-
  151.    bit bytes representable as printable ASCII characters before invoking
  152.    a local mail UA (User Agent, a program with which human users send
  153.    and receive mail). Examples of such encodings currently used in the
  154.    Internet include pure hexadecimal, uuencode, the 3-in-4 base 64
  155.    scheme specified in RFC 1421, the Andrew Toolkit Representation
  156.    [ATK], and many others.
  157.  
  158.    The limitations of RFC 822 mail become even more apparent as gateways
  159.    are designed to allow for the exchange of mail messages between RFC
  160.    822 hosts and X.400 hosts. X.400 [X400] specifies mechanisms for the
  161.    inclusion of non-textual body parts within electronic mail messages.
  162.    The current standards for the mapping of X.400 messages to RFC 822
  163.    messages specify either that X.400 non-textual body parts must be
  164.    converted to (not encoded in) an ASCII format, or that they must be
  165.    discarded, notifying the RFC 822 user that discarding has occurred.
  166.    This is clearly undesirable, as information that a user may wish to
  167.  
  168.  
  169.  
  170. Borenstein & Freed                                              [Page 3]
  171.  
  172. RFC 1521                          MIME                    September 1993
  173.  
  174.  
  175.    receive is lost.  Even though a user's UA may not have the capability
  176.    of dealing with the non-textual body part, the user might have some
  177.    mechanism external to the UA that can extract useful information from
  178.    the body part.  Moreover, it does not allow for the fact that the
  179.    message may eventually be gatewayed back into an X.400 message
  180.    handling system (i.e., the X.400 message is "tunneled" through
  181.    Internet mail), where the non-textual information would definitely
  182.    become useful again.
  183.  
  184.    This document describes several mechanisms that combine to solve most
  185.    of these problems without introducing any serious incompatibilities
  186.    with the existing world of RFC 822 mail.  In particular, it
  187.    describes:
  188.  
  189.    1. A MIME-Version header field, which uses a version number to
  190.        declare a message to be conformant with this specification and
  191.        allows mail processing agents to distinguish between such
  192.        messages and those generated by older or non-conformant software,
  193.        which is presumed to lack such a field.
  194.  
  195.    2. A Content-Type header field, generalized from RFC 1049 [RFC-1049],
  196.        which can be used to specify the type and subtype of data in the
  197.        body of a message and to fully specify the native representation
  198.        (encoding) of such data.
  199.  
  200.        2.a. A "text" Content-Type value, which can be used to represent
  201.             textual information in a number of character sets and
  202.             formatted text description languages in a standardized
  203.             manner.
  204.  
  205.        2.b. A "multipart" Content-Type value, which can be used to
  206.             combine several body parts, possibly of differing types of
  207.             data, into a single message.
  208.  
  209.        2.c. An "application" Content-Type value, which can be used to
  210.             transmit application data or binary data, and hence, among
  211.             other uses, to implement an electronic mail file transfer
  212.             service.
  213.  
  214.        2.d. A "message" Content-Type value, for encapsulating another
  215.             mail message.
  216.  
  217.        2.e An "image" Content-Type value, for transmitting still image
  218.             (picture) data.
  219.  
  220.        2.f. An "audio" Content-Type value, for transmitting audio or
  221.             voice data.
  222.  
  223.  
  224.  
  225.  
  226. Borenstein & Freed                                              [Page 4]
  227.  
  228. RFC 1521                          MIME                    September 1993
  229.  
  230.  
  231.        2.g. A "video" Content-Type value, for transmitting video or
  232.             moving image data, possibly with audio as part of the
  233.             composite video data format.
  234.  
  235.    3. A Content-Transfer-Encoding header field, which can be used to
  236.        specify an auxiliary encoding that was applied to the data in
  237.        order to allow it to pass through mail transport mechanisms which
  238.        may have data or character set limitations.
  239.  
  240.    4. Two additional header fields that can be used to further describe
  241.        the data in a message body, the Content-ID and Content-
  242.        Description header fields.
  243.  
  244.    MIME has been carefully designed as an extensible mechanism, and it
  245.    is expected that the set of content-type/subtype pairs and their
  246.    associated parameters will grow significantly with time.  Several
  247.    other MIME fields, notably including character set names, are likely
  248.    to have new values defined over time.  In order to ensure that the
  249.    set of such values is developed in an orderly, well-specified, and
  250.    public manner, MIME defines a registration process which uses the
  251.    Internet Assigned Numbers Authority (IANA) as a central registry for
  252.    such values.  Appendix E provides details about how IANA registration
  253.    is accomplished.
  254.  
  255.    Finally, to specify and promote interoperability, Appendix A of this
  256.    document provides a basic applicability statement for a subset of the
  257.    above mechanisms that defines a minimal level of "conformance" with
  258.    this document.
  259.  
  260.       HISTORICAL NOTE: Several of the mechanisms described in this
  261.       document may seem somewhat strange or even baroque at first
  262.       reading.  It is important to note that compatibility with existing
  263.       standards AND robustness across existing practice were two of the
  264.       highest priorities of the working group that developed this
  265.       document.  In particular, compatibility was always favored over
  266.       elegance.
  267.  
  268.    MIME was first defined and published as RFCs 1341 and 1342 [RFC-1341]
  269.    [RFC-1342].  This document is a relatively minor updating of RFC
  270.    1341, and is intended to supersede it.  The differences between this
  271.    document and RFC 1341 are summarized in Appendix H.  Please refer to
  272.    the current edition of the "IAB Official Protocol Standards" for the
  273.    standardization state and status of this protocol.  Several other RFC
  274.    documents will be of interest to the MIME implementor, in particular
  275.    [RFC 1343], [RFC-1344], and [RFC-1345].
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282. Borenstein & Freed                                              [Page 5]
  283.  
  284. RFC 1521                          MIME                    September 1993
  285.  
  286.  
  287. 2.    Notations, Conventions, and Generic BNF Grammar
  288.  
  289.    This document is being published in two versions, one as plain ASCII
  290.    text and one as PostScript (PostScript is a trademark of Adobe
  291.    Systems Incorporated.).  While the text version is the official
  292.    specification, some will find the PostScript version easier to read.
  293.    The textual contents are identical.  An Andrew-format copy of this
  294.    document is also available from the first author (Borenstein).
  295.  
  296.    Although the mechanisms specified in this document are all described
  297.    in prose, most are also described formally in the modified BNF
  298.    notation of RFC 822.  Implementors will need to be familiar with this
  299.    notation in order to understand this specification, and are referred
  300.    to RFC 822 for a complete explanation of the modified BNF notation.
  301.  
  302.    Some of the modified BNF in this document makes reference to
  303.    syntactic entities that are defined in RFC 822 and not in this
  304.    document.  A complete formal grammar, then, is obtained by combining
  305.    the collected grammar appendix of this document with that of RFC 822
  306.    plus the modifications to RFC 822 defined in RFC 1123, which
  307.    specifically changes the syntax for `return', `date' and `mailbox'.
  308.  
  309.    The term CRLF, in this document, refers to the sequence of the two
  310.    ASCII characters CR (13) and LF (10) which, taken together, in this
  311.    order, denote a line break in RFC 822 mail.
  312.  
  313.    The term "character set" is used in this document to refer to a
  314.    method used with one or more tables to convert encoded text to a
  315.    series of octets.  This definition is intended to allow various kinds
  316.    of text encodings, from simple single-table mappings such as ASCII to
  317.    complex table switching methods such as those that use ISO 2022's
  318.    techniques.  However, a MIME character set name must fully specify
  319.    the mapping to be performed.
  320.  
  321.    The term "message", when not further qualified, means either the
  322.    (complete or "top-level") message being transferred on a network, or
  323.    a message encapsulated in a body of type "message".
  324.  
  325.    The term "body part", in this document, means one of the parts of the
  326.    body of a multipart entity. A body part has a header and a body, so
  327.    it makes sense to speak about the body of a body part.
  328.  
  329.    The term "entity", in this document, means either a message or a body
  330.    part.  All kinds of entities share the property that they have a
  331.    header and a body.
  332.  
  333.    The term "body", when not further qualified, means the body of an
  334.    entity, that is the body of either a message or of a body part.
  335.  
  336.  
  337.  
  338. Borenstein & Freed                                              [Page 6]
  339.  
  340. RFC 1521                          MIME                    September 1993
  341.  
  342.  
  343.       NOTE: The previous four definitions are clearly circular.  This is
  344.       unavoidable, since the overall structure of a MIME message is
  345.       indeed recursive.
  346.  
  347.    In this document, all numeric and octet values are given in decimal
  348.    notation.
  349.  
  350.    It must be noted that Content-Type values, subtypes, and parameter
  351.    names as defined in this document are case-insensitive.  However,
  352.    parameter values are case-sensitive unless otherwise specified for
  353.    the specific parameter.
  354.  
  355.       FORMATTING NOTE: This document has been carefully formatted for
  356.       ease of reading.  The PostScript version of this document, in
  357.       particular, places notes like this one, which may be skipped by
  358.       the reader, in a smaller, italicized, font, and indents it as
  359.       well.  In the text version, only the indentation is preserved, so
  360.       if you are reading the text version of this you might consider
  361.       using the PostScript version instead. However, all such notes will
  362.       be indented and preceded by "NOTE:" or some similar introduction,
  363.       even in the text version.
  364.  
  365.       The primary purpose of these non-essential notes is to convey
  366.       information about the rationale of this document, or to place this
  367.       document in the proper historical or evolutionary context.  Such
  368.       information may be skipped by those who are focused entirely on
  369.       building a conformant implementation, but may be of use to those
  370.       who wish to understand why this document is written as it is.
  371.  
  372.       For ease of recognition, all BNF definitions have been placed in a
  373.       fixed-width font in the PostScript version of this document.
  374.  
  375. 3.    The MIME-Version Header Field
  376.  
  377.    Since RFC 822 was published in 1982, there has really been only one
  378.    format standard for Internet messages, and there has been little
  379.    perceived need to declare the format standard in use.  This document
  380.    is an independent document that complements RFC 822. Although the
  381.    extensions in this document have been defined in such a way as to be
  382.    compatible with RFC 822, there are still circumstances in which it
  383.    might be desirable for a mail-processing agent to know whether a
  384.    message was composed with the new standard in mind.
  385.  
  386.    Therefore, this document defines a new header field, "MIME-Version",
  387.    which is to be used to declare the version of the Internet message
  388.    body format standard in use.
  389.  
  390.    Messages composed in accordance with this document MUST include such
  391.  
  392.  
  393.  
  394. Borenstein & Freed                                              [Page 7]
  395.  
  396. RFC 1521                          MIME                    September 1993
  397.  
  398.  
  399.    a header field, with the following verbatim text:
  400.  
  401.    MIME-Version: 1.0
  402.  
  403.    The presence of this header field is an assertion that the message
  404.    has been composed in compliance with this document.
  405.  
  406.    Since it is possible that a future document might extend the message
  407.    format standard again, a formal BNF is given for the content of the
  408.    MIME-Version field:
  409.  
  410.    version := "MIME-Version" ":" 1*DIGIT "." 1*DIGIT
  411.  
  412.    Thus, future format specifiers, which might replace or extend "1.0",
  413.    are constrained to be two integer fields, separated by a period.  If
  414.    a message is received with a MIME-version value other than "1.0", it
  415.    cannot be assumed to conform with this specification.
  416.  
  417.    Note that the MIME-Version header field is required at the top level
  418.    of a message. It is not required for each body part of a multipart
  419.    entity.  It is required for the embedded headers of a body of type
  420.    "message" if and only if the embedded message is itself claimed to be
  421.    MIME-conformant.
  422.  
  423.    It is not possible to fully specify how a mail reader that conforms
  424.    with MIME as defined in this document should treat a message that
  425.    might arrive in the future with some value of MIME-Version other than
  426.    "1.0".  However, conformant software is encouraged to check the
  427.    version number and at least warn the user if an unrecognized MIME-
  428.    version is encountered.
  429.  
  430.    It is also worth noting that version control for specific content-
  431.    types is not accomplished using the MIME-Version mechanism.  In
  432.    particular, some formats (such as application/postscript) have
  433.    version numbering conventions that are internal to the document
  434.    format.  Where such conventions exist, MIME does nothing to supersede
  435.    them.  Where no such conventions exist, a MIME type might use a
  436.    "version" parameter in the content-type field if necessary.
  437.  
  438.    NOTE TO IMPLEMENTORS: All header fields defined in this document,
  439.    including MIME-Version, Content-type, etc., are subject to the
  440.    general syntactic rules for header fields specified in RFC 822.  In
  441.    particular, all can include comments, which means that the following
  442.    two MIME-Version fields are equivalent:
  443.  
  444.                     MIME-Version: 1.0
  445.                     MIME-Version: 1.0 (Generated by GBD-killer 3.7)
  446.  
  447.  
  448.  
  449.  
  450. Borenstein & Freed                                              [Page 8]
  451.  
  452. RFC 1521                          MIME                    September 1993
  453.  
  454.  
  455. 4.    The Content-Type Header Field
  456.  
  457.    The purpose of the Content-Type field is to describe the data
  458.    contained in the body fully enough that the receiving user agent can
  459.    pick an appropriate agent or mechanism to present the data to the
  460.    user, or otherwise deal with the data in an appropriate manner.
  461.  
  462.    HISTORICAL NOTE: The Content-Type header field was first defined in
  463.    RFC 1049.  RFC 1049 Content-types used a simpler and less powerful
  464.    syntax, but one that is largely compatible with the mechanism given
  465.    here.
  466.  
  467.    The Content-Type header field is used to specify the nature of the
  468.    data in the body of an entity, by giving type and subtype
  469.    identifiers, and by providing auxiliary information that may be
  470.    required for certain types.  After the type and subtype names, the
  471.    remainder of the header field is simply a set of parameters,
  472.    specified in an attribute/value notation.  The set of meaningful
  473.    parameters differs for the different types.  In particular, there are
  474.    NO globally-meaningful parameters that apply to all content-types.
  475.    Global mechanisms are best addressed, in the MIME model, by the
  476.    definition of additional Content-* header fields.  The ordering of
  477.    parameters is not significant.  Among the defined parameters is a
  478.    "charset" parameter by which the character set used in the body may
  479.    be declared. Comments are allowed in accordance with RFC 822 rules
  480.    for structured header fields.
  481.  
  482.    In general, the top-level Content-Type is used to declare the general
  483.    type of data, while the subtype specifies a specific format for that
  484.    type of data.  Thus, a Content-Type of "image/xyz" is enough to tell
  485.    a user agent that the data is an image, even if the user agent has no
  486.    knowledge of the specific image format "xyz".  Such information can
  487.    be used, for example, to decide whether or not to show a user the raw
  488.    data from an unrecognized subtype -- such an action might be
  489.    reasonable for unrecognized subtypes of text, but not for
  490.    unrecognized subtypes of image or audio.  For this reason, registered
  491.    subtypes of audio, image, text, and video, should not contain
  492.    embedded information that is really of a different type.  Such
  493.    compound types should be represented using the "multipart" or
  494.    "application" types.
  495.  
  496.    Parameters are modifiers of the content-subtype, and do not
  497.    fundamentally affect the requirements of the host system.  Although
  498.    most parameters make sense only with certain content-types, others
  499.    are "global" in the sense that they might apply to any subtype.  For
  500.    example, the "boundary" parameter makes sense only for the
  501.    "multipart" content-type, but the "charset" parameter might make
  502.    sense with several content-types.
  503.  
  504.  
  505.  
  506. Borenstein & Freed                                              [Page 9]
  507.  
  508. RFC 1521                          MIME                    September 1993
  509.  
  510.  
  511.    An initial set of seven Content-Types is defined by this document.
  512.    This set of top-level names is intended to be substantially complete.
  513.    It is expected that additions to the larger set of supported types
  514.    can generally be accomplished by the creation of new subtypes of
  515.    these initial types.  In the future, more top-level types may be
  516.    defined only by an extension to this standard.  If another primary
  517.    type is to be used for any reason, it must be given a name starting
  518.    with "X-" to indicate its non-standard status and to avoid a
  519.    potential conflict with a future official name.
  520.  
  521.    In the Augmented BNF notation of RFC 822, a Content-Type header field
  522.    value is defined as follows:
  523.  
  524.      content  :=   "Content-Type"  ":"  type  "/"  subtype  *(";"
  525.      parameter)
  526.                ; case-insensitive matching of type and subtype
  527.  
  528.      type :=          "application"     / "audio"
  529.                / "image"           / "message"
  530.                / "multipart"  / "text"
  531.                / "video"           / extension-token
  532.                ; All values case-insensitive
  533.  
  534.      extension-token :=  x-token / iana-token
  535.  
  536.      iana-token := <a publicly-defined extension token,
  537.                registered with IANA, as specified in
  538.                appendix E>
  539.  
  540.      x-token := <The two characters "X-" or "x-" followed, with
  541.                  no intervening white space, by any token>
  542.  
  543.      subtype := token ; case-insensitive
  544.  
  545.      parameter := attribute "=" value
  546.  
  547.      attribute := token   ; case-insensitive
  548.  
  549.      value := token / quoted-string
  550.  
  551.      token  :=  1*<any (ASCII) CHAR except SPACE, CTLs,
  552.                    or tspecials>
  553.  
  554.      tspecials :=  "(" / ")" / "<" / ">" / "@"
  555.                 /  "," / ";" / ":" / "\" / <">
  556.                 /  "/" / "[" / "]" / "?" / "="
  557.                ; Must be in quoted-string,
  558.                ; to use within parameter values
  559.  
  560.  
  561.  
  562. Borenstein & Freed                                             [Page 10]
  563.  
  564. RFC 1521                          MIME                    September 1993
  565.  
  566.  
  567.    Note that the definition of "tspecials" is the same as the RFC 822
  568.    definition of "specials" with the addition of the three characters
  569.    "/", "?", and "=", and the removal of ".".
  570.  
  571.    Note also that a subtype specification is MANDATORY.  There are no
  572.    default subtypes.
  573.  
  574.    The type, subtype, and parameter names are not case sensitive.  For
  575.    example, TEXT, Text, and TeXt are all equivalent.  Parameter values
  576.    are normally case sensitive, but certain parameters are interpreted
  577.    to be case-insensitive, depending on the intended use.  (For example,
  578.    multipart boundaries are case-sensitive, but the "access-type" for
  579.    message/External-body is not case-sensitive.)
  580.  
  581.    Beyond this syntax, the only constraint on the definition of subtype
  582.    names is the desire that their uses must not conflict.  That is, it
  583.    would be undesirable to have two different communities using
  584.    "Content-Type: application/foobar" to mean two different things.  The
  585.    process of defining new content-subtypes, then, is not intended to be
  586.    a mechanism for imposing restrictions, but simply a mechanism for
  587.    publicizing the usages. There are, therefore, two acceptable
  588.    mechanisms for defining new Content-Type subtypes:
  589.  
  590.             1.  Private values (starting with "X-") may be
  591.                 defined bilaterally between two cooperating
  592.                 agents without outside registration or
  593.                 standardization.
  594.  
  595.             2.  New standard values must be documented,
  596.                 registered with, and approved by IANA, as
  597.                 described in Appendix E.  Where intended for
  598.                 public use, the formats they refer to must
  599.                 also be defined by a published specification,
  600.                 and possibly offered for standardization.
  601.  
  602.    The seven standard initial predefined Content-Types are detailed in
  603.    the bulk of this document.  They are:
  604.  
  605.     text -- textual information.  The primary subtype,
  606.          "plain", indicates plain (unformatted) text.  No
  607.          special software is required to get the full
  608.          meaning of the text, aside from support for the
  609.          indicated character set.  Subtypes are to be used
  610.          for enriched text in forms where application
  611.          software may enhance the appearance of the text,
  612.          but such software must not be required in order to
  613.          get the general idea of the content.  Possible
  614.          subtypes thus include any readable word processor
  615.  
  616.  
  617.  
  618. Borenstein & Freed                                             [Page 11]
  619.  
  620. RFC 1521                          MIME                    September 1993
  621.  
  622.  
  623.          format.  A very simple and portable subtype,
  624.          richtext, was defined in RFC 1341, with a future
  625.          revision expected.
  626.  
  627.     multipart -- data consisting of multiple parts of
  628.          independent data types.  Four initial subtypes
  629.          are defined, including the primary "mixed"
  630.          subtype, "alternative" for representing the same
  631.          data in multiple formats, "parallel" for parts
  632.          intended to be viewed simultaneously, and "digest"
  633.          for multipart entities in which each part is of
  634.          type "message".
  635.  
  636.     message -- an encapsulated message.  A body of
  637.          Content-Type "message" is itself all or part of a
  638.          fully formatted RFC 822 conformant message which
  639.          may contain its own different Content-Type header
  640.          field.  The primary subtype is "rfc822".  The
  641.          "partial" subtype is defined for partial messages,
  642.          to permit the fragmented transmission of bodies
  643.          that are thought to be too large to be passed
  644.          through mail transport facilities.  Another
  645.          subtype, "External-body", is defined for
  646.          specifying large bodies by reference to an
  647.          external data source.
  648.  
  649.     image -- image data.  Image requires a display device
  650.          (such as a graphical display, a printer, or a FAX
  651.          machine) to view the information.  Initial
  652.          subtypes are defined for two widely-used image
  653.          formats, jpeg and gif.
  654.  
  655.     audio -- audio data, with initial subtype "basic".
  656.          Audio requires an audio output device (such as a
  657.          speaker or a telephone) to "display" the contents.
  658.  
  659.     video -- video data.  Video requires the capability to
  660.          display moving images, typically including
  661.          specialized hardware and software.  The initial
  662.          subtype is "mpeg".
  663.  
  664.     application -- some other kind of data, typically
  665.          either uninterpreted binary data or information to
  666.          be processed by a mail-based application.  The
  667.          primary subtype, "octet-stream", is to be used in
  668.          the case of uninterpreted binary data, in which
  669.          case the simplest recommended action is to offer
  670.          to write the information into a file for the user.
  671.  
  672.  
  673.  
  674. Borenstein & Freed                                             [Page 12]
  675.  
  676. RFC 1521                          MIME                    September 1993
  677.  
  678.  
  679.          An additional subtype, "PostScript", is defined
  680.          for transporting PostScript documents in bodies.
  681.          Other expected uses for "application" include
  682.          spreadsheets, data for mail-based scheduling
  683.          systems, and languages for "active"
  684.          (computational) email.  (Note that active email
  685.          and other application data may entail several
  686.          security considerations, which are discussed later
  687.          in this memo, particularly in the context of
  688.          application/PostScript.)
  689.  
  690.    Default RFC 822 messages are typed by this protocol as plain text in
  691.    the US-ASCII character set, which can be explicitly specified as
  692.    "Content-type: text/plain; charset=us-ascii".  If no Content-Type is
  693.    specified, this default is assumed.  In the presence of a MIME-
  694.    Version header field, a receiving User Agent can also assume that
  695.    plain US-ASCII text was the sender's intent.  In the absence of a
  696.    MIME-Version specification, plain US-ASCII text must still be
  697.    assumed, but the sender's intent might have been otherwise.
  698.  
  699.       RATIONALE: In the absence of any Content-Type header field or
  700.       MIME-Version header field, it is impossible to be certain that a
  701.       message is actually text in the US-ASCII character set, since it
  702.       might well be a message that, using the conventions that predate
  703.       this document, includes text in another character set or non-
  704.       textual data in a manner that cannot be automatically recognized
  705.       (e.g., a uuencoded compressed UNIX tar file).  Although there is
  706.       no fully acceptable alternative to treating such untyped messages
  707.       as "text/plain; charset=us-ascii", implementors should remain
  708.       aware that if a message lacks both the MIME-Version and the
  709.       Content-Type header fields, it may in practice contain almost
  710.       anything.
  711.  
  712.    It should be noted that the list of Content-Type values given here
  713.    may be augmented in time, via the mechanisms described above, and
  714.    that the set of subtypes is expected to grow substantially.
  715.  
  716.    When a mail reader encounters mail with an unknown Content-type
  717.    value, it should generally treat it as equivalent to
  718.    "application/octet-stream", as described later in this document.
  719.  
  720. 5.    The Content-Transfer-Encoding Header Field
  721.  
  722.    Many Content-Types which could usefully be transported via email are
  723.    represented, in their "natural" format, as 8-bit character or binary
  724.    data.  Such data cannot be transmitted over some transport protocols.
  725.    For example, RFC 821 restricts mail messages to 7-bit US-ASCII data
  726.    with lines no longer than 1000 characters.
  727.  
  728.  
  729.  
  730. Borenstein & Freed                                             [Page 13]
  731.  
  732. RFC 1521                          MIME                    September 1993
  733.  
  734.  
  735.    It is necessary, therefore, to define a standard mechanism for re-
  736.    encoding such data into a 7-bit short-line format.  This document
  737.    specifies that such encodings will be indicated by a new "Content-
  738.    Transfer-Encoding" header field.  The Content-Transfer-Encoding field
  739.    is used to indicate the type of transformation that has been used in
  740.    order to represent the body in an acceptable manner for transport.
  741.  
  742.    Unlike Content-Types, a proliferation of Content-Transfer-Encoding
  743.    values is undesirable and unnecessary.  However, establishing only a
  744.    single Content-Transfer-Encoding mechanism does not seem possible.
  745.    There is a tradeoff between the desire for a compact and efficient
  746.    encoding of largely-binary data and the desire for a readable
  747.    encoding of data that is mostly, but not entirely, 7-bit data.  For
  748.    this reason, at least two encoding mechanisms are necessary: a
  749.    "readable" encoding and a "dense" encoding.
  750.  
  751.    The Content-Transfer-Encoding field is designed to specify an
  752.    invertible mapping between the "native" representation of a type of
  753.    data and a representation that can be readily exchanged using 7 bit
  754.    mail transport protocols, such as those defined by RFC 821 (SMTP).
  755.    This field has not been defined by any previous standard. The field's
  756.    value is a single token specifying the type of encoding, as
  757.    enumerated below.  Formally:
  758.  
  759.    encoding := "Content-Transfer-Encoding" ":" mechanism
  760.  
  761.    mechanism :=     "7bit"  ;  case-insensitive
  762.                   / "quoted-printable"
  763.                   / "base64"
  764.                   / "8bit"
  765.                   / "binary"
  766.                   / x-token
  767.  
  768.    These values are not case sensitive.  That is, Base64 and BASE64 and
  769.    bAsE64 are all equivalent.  An encoding type of 7BIT requires that
  770.    the body is already in a seven-bit mail-ready representation.  This
  771.    is the default value -- that is, "Content-Transfer-Encoding: 7BIT" is
  772.    assumed if the Content-Transfer-Encoding header field is not present.
  773.  
  774.    The values "8bit", "7bit", and "binary" all mean that NO encoding has
  775.    been performed. However, they are potentially useful as indications
  776.    of the kind of data contained in the object, and therefore of the
  777.    kind of encoding that might need to be performed for transmission in
  778.    a given transport system.  In particular:
  779.  
  780.        "7bit" means that the data is all represented as short
  781.             lines of US-ASCII data.
  782.  
  783.  
  784.  
  785.  
  786. Borenstein & Freed                                             [Page 14]
  787.  
  788. RFC 1521                          MIME                    September 1993
  789.  
  790.  
  791.        "8bit" means that the lines are short, but there may be
  792.             non-ASCII characters (octets with the high-order
  793.             bit set).
  794.  
  795.        "Binary" means that not only may non-ASCII characters
  796.             be present, but also that the lines are not
  797.             necessarily short enough for SMTP transport.
  798.  
  799.    The difference between "8bit" (or any other conceivable bit-width
  800.    token) and the "binary" token is that "binary" does not require
  801.    adherence to any limits on line length or to the SMTP CRLF semantics,
  802.    while the bit-width tokens do require such adherence.  If the body
  803.    contains data in any bit-width other than 7-bit, the appropriate
  804.    bit-width Content-Transfer-Encoding token must be used (e.g., "8bit"
  805.    for unencoded 8 bit wide data).  If the body contains binary data,
  806.    the "binary" Content-Transfer-Encoding token must be used.
  807.  
  808.       NOTE: The distinction between the Content-Transfer-Encoding values
  809.       of "binary", "8bit", etc.  may seem unimportant, in that all of
  810.       them really mean "none" -- that is, there has been no encoding of
  811.       the data for transport.  However, clear labeling will be of
  812.       enormous value to gateways between future mail transport systems
  813.       with differing capabilities in transporting data that do not meet
  814.       the restrictions of RFC 821 transport.
  815.  
  816.       Mail transport for unencoded 8-bit data is defined in RFC-1426
  817.       [RFC-1426].  As of the publication of this document, there are no
  818.       standardized Internet mail transports for which it is legitimate
  819.       to include unencoded binary data in mail bodies.  Thus there are
  820.       no circumstances in which the "binary" Content-Transfer-Encoding
  821.       is actually legal on the Internet.  However, in the event that
  822.       binary mail transport becomes a reality in Internet mail, or when
  823.       this document is used in conjunction with any other binary-capable
  824.       transport mechanism, binary bodies should be labeled as such using
  825.       this mechanism.
  826.  
  827.       NOTE: The five values defined for the Content-Transfer-Encoding
  828.       field imply nothing about the Content-Type other than the
  829.       algorithm by which it was encoded or the transport system
  830.       requirements if unencoded.
  831.  
  832.    Implementors may, if necessary, define new Content-Transfer-Encoding
  833.    values, but must use an x-token, which is a name prefixed by "X-" to
  834.    indicate its non-standard status, e.g., "Content-Transfer-Encoding:
  835.    x-my-new-encoding".  However, unlike Content-Types and subtypes, the
  836.    creation of new Content-Transfer-Encoding values is explicitly and
  837.    strongly discouraged, as it seems likely to hinder interoperability
  838.    with little potential benefit.  Their use is allowed only as the
  839.  
  840.  
  841.  
  842. Borenstein & Freed                                             [Page 15]
  843.  
  844. RFC 1521                          MIME                    September 1993
  845.  
  846.  
  847.    result of an agreement between cooperating user agents.
  848.  
  849.    If a Content-Transfer-Encoding header field appears as part of a
  850.    message header, it applies to the entire body of that message.  If a
  851.    Content-Transfer-Encoding header field appears as part of a body
  852.    part's headers, it applies only to the body of that body part.  If an
  853.    entity is of type "multipart" or "message", the Content-Transfer-
  854.    Encoding is not permitted to have any value other than a bit width
  855.    (e.g., "7bit", "8bit", etc.) or "binary".
  856.  
  857.    It should be noted that email is character-oriented, so that the
  858.    mechanisms described here are mechanisms for encoding arbitrary octet
  859.    streams, not bit streams.  If a bit stream is to be encoded via one
  860.    of these mechanisms, it must first be converted to an 8-bit byte
  861.    stream using the network standard bit order ("big-endian"), in which
  862.    the earlier bits in a stream become the higher-order bits in a byte.
  863.    A bit stream not ending at an 8-bit boundary must be padded with
  864.    zeroes.  This document provides a mechanism for noting the addition
  865.    of such padding in the case of the application Content-Type, which
  866.    has a "padding" parameter.
  867.  
  868.    The encoding mechanisms defined here explicitly encode all data in
  869.    ASCII.  Thus, for example, suppose an entity has header fields such
  870.    as:
  871.  
  872.         Content-Type: text/plain; charset=ISO-8859-1
  873.         Content-transfer-encoding: base64
  874.  
  875.    This must be interpreted to mean that the body is a base64 ASCII
  876.    encoding of data that was originally in ISO-8859-1, and will be in
  877.    that character set again after decoding.
  878.  
  879.    The following sections will define the two standard encoding
  880.    mechanisms.  The definition of new content-transfer-encodings is
  881.    explicitly discouraged and should only occur when absolutely
  882.    necessary.  All content-transfer-encoding namespace except that
  883.    beginning with "X-" is explicitly reserved to the IANA for future
  884.    use.  Private agreements about content-transfer-encodings are also
  885.    explicitly discouraged.
  886.  
  887.    Certain Content-Transfer-Encoding values may only be used on certain
  888.    Content-Types.  In particular, it is expressly forbidden to use any
  889.    encodings other than "7bit", "8bit", or "binary" with any Content-
  890.    Type that recursively includes other Content-Type fields, notably the
  891.    "multipart" and "message" Content-Types.  All encodings that are
  892.    desired for bodies of type multipart or message must be done at the
  893.    innermost level, by encoding the actual body that needs to be
  894.    encoded.
  895.  
  896.  
  897.  
  898. Borenstein & Freed                                             [Page 16]
  899.  
  900. RFC 1521                          MIME                    September 1993
  901.  
  902.  
  903.       NOTE ON ENCODING RESTRICTIONS: Though the prohibition against
  904.       using content-transfer-encodings on data of type multipart or
  905.       message may seem overly restrictive, it is necessary to prevent
  906.       nested encodings, in which data are passed through an encoding
  907.       algorithm multiple times, and must be decoded multiple times in
  908.       order to be properly viewed.  Nested encodings add considerable
  909.       complexity to user agents: aside from the obvious efficiency
  910.       problems with such multiple encodings, they can obscure the basic
  911.       structure of a message.  In particular, they can imply that
  912.       several decoding operations are necessary simply to find out what
  913.       types of objects a message contains.  Banning nested encodings may
  914.       complicate the job of certain mail gateways, but this seems less
  915.       of a problem than the effect of nested encodings on user agents.
  916.  
  917.       NOTE ON THE RELATIONSHIP BETWEEN CONTENT-TYPE AND CONTENT-
  918.       TRANSFER-ENCODING: It may seem that the Content-Transfer-Encoding
  919.       could be inferred from the characteristics of the Content-Type
  920.       that is to be encoded, or, at the very least, that certain
  921.       Content-Transfer-Encodings could be mandated for use with specific
  922.       Content-Types. There are several reasons why this is not the case.
  923.       First, given the varying types of transports used for mail, some
  924.       encodings may be appropriate for some Content-Type/transport
  925.       combinations and not for others.  (For example, in an 8-bit
  926.       transport, no encoding would be required for text in certain
  927.       character sets, while such encodings are clearly required for 7-
  928.       bit SMTP.)  Second, certain Content-Types may require different
  929.       types of transfer encoding under different circumstances. For
  930.       example, many PostScript bodies might consist entirely of short
  931.       lines of 7-bit data and hence require little or no encoding.
  932.       Other PostScript bodies (especially those using Level 2
  933.       PostScript's binary encoding mechanism) may only be reasonably
  934.       represented using a binary transport encoding. Finally, since
  935.       Content-Type is intended to be an open-ended specification
  936.       mechanism, strict specification of an association between
  937.       Content-Types and encodings effectively couples the specification
  938.       of an application protocol with a specific lower-level transport.
  939.       This is not desirable since the developers of a Content-Type
  940.       should not have to be aware of all the transports in use and what
  941.       their limitations are.
  942.  
  943.       NOTE ON TRANSLATING ENCODINGS: The quoted-printable and base64
  944.       encodings are designed so that conversion between them is
  945.       possible.  The only issue that arises in such a conversion is the
  946.       handling of line breaks.  When converting from quoted-printable to
  947.       base64 a line break must be converted into a CRLF sequence.
  948.       Similarly, a CRLF sequence in base64 data must be converted to a
  949.       quoted-printable line break, but ONLY when converting text data.
  950.  
  951.  
  952.  
  953.  
  954. Borenstein & Freed                                             [Page 17]
  955.  
  956. RFC 1521                          MIME                    September 1993
  957.  
  958.  
  959.       NOTE ON CANONICAL ENCODING MODEL: There was some confusion, in
  960.       earlier drafts of this memo, regarding the model for when email
  961.       data was to be converted to canonical form and encoded, and in
  962.       particular how this process would affect the treatment of CRLFs,
  963.       given that the representation of newlines varies greatly from
  964.       system to system, and the relationship between content-transfer-
  965.       encodings and character sets.  For this reason, a canonical model
  966.       for encoding is presented as Appendix G.
  967.  
  968. 5.1.  Quoted-Printable Content-Transfer-Encoding
  969.  
  970.    The Quoted-Printable encoding is intended to represent data that
  971.    largely consists of octets that correspond to printable characters in
  972.    the ASCII character set.  It encodes the data in such a way that the
  973.    resulting octets are unlikely to be modified by mail transport.  If
  974.    the data being encoded are mostly ASCII text, the encoded form of the
  975.    data remains largely recognizable by humans.  A body which is
  976.    entirely ASCII may also be encoded in Quoted-Printable to ensure the
  977.    integrity of the data should the message pass through a character-
  978.    translating, and/or line-wrapping gateway.
  979.  
  980.    In this encoding, octets are to be represented as determined by the
  981.    following rules:
  982.  
  983.       Rule #1: (General 8-bit representation) Any octet, except those
  984.       indicating a line break according to the newline convention of the
  985.       canonical (standard) form of the data being encoded, may be
  986.       represented by an "=" followed by a two digit hexadecimal
  987.       representation of the octet's value.  The digits of the
  988.       hexadecimal alphabet, for this purpose, are "0123456789ABCDEF".
  989.       Uppercase letters must be used when sending hexadecimal data,
  990.       though a robust implementation may choose to recognize lowercase
  991.       letters on receipt.  Thus, for example, the value 12 (ASCII form
  992.       feed) can be represented by "=0C", and the value 61 (ASCII EQUAL
  993.       SIGN) can be represented by "=3D".  Except when the following
  994.       rules allow an alternative encoding, this rule is mandatory.
  995.  
  996.       Rule #2: (Literal representation) Octets with decimal values of 33
  997.       through 60 inclusive, and 62 through 126, inclusive, MAY be
  998.       represented as the ASCII characters which correspond to those
  999.       octets (EXCLAMATION POINT through LESS THAN, and GREATER THAN
  1000.       through TILDE, respectively).
  1001.  
  1002.       Rule #3: (White Space): Octets with values of 9 and 32 MAY be
  1003.       represented as ASCII TAB (HT) and SPACE characters, respectively,
  1004.       but MUST NOT be so represented at the end of an encoded line. Any
  1005.       TAB (HT) or SPACE characters on an encoded line MUST thus be
  1006.       followed on that line by a printable character.  In particular, an
  1007.  
  1008.  
  1009.  
  1010. Borenstein & Freed                                             [Page 18]
  1011.  
  1012. RFC 1521                          MIME                    September 1993
  1013.  
  1014.  
  1015.       "=" at the end of an encoded line, indicating a soft line break
  1016.       (see rule #5) may follow one or more TAB (HT) or SPACE characters.
  1017.       It follows that an octet with value 9 or 32 appearing at the end
  1018.       of an encoded line must be represented according to Rule #1.  This
  1019.       rule is necessary because some MTAs (Message Transport Agents,
  1020.       programs which transport messages from one user to another, or
  1021.       perform a part of such transfers) are known to pad lines of text
  1022.       with SPACEs, and others are known to remove "white space"
  1023.       characters from the end of a line.  Therefore, when decoding a
  1024.       Quoted-Printable body, any trailing white space on a line must be
  1025.       deleted, as it will necessarily have been added by intermediate
  1026.       transport agents.
  1027.  
  1028.       Rule #4 (Line Breaks): A line break in a text body, independent of
  1029.       what its representation is following the canonical representation
  1030.       of the data being encoded, must be represented by a (RFC 822) line
  1031.       break, which is a CRLF sequence, in the Quoted-Printable encoding.
  1032.       Since the canonical representation of types other than text do not
  1033.       generally include the representation of line breaks, no hard line
  1034.       breaks (i.e.  line breaks that are intended to be meaningful and
  1035.       to be displayed to the user) should occur in the quoted-printable
  1036.       encoding of such types.  Of course, occurrences of "=0D", "=0A",
  1037.       "0A=0D" and "=0D=0A" will eventually be encountered.  In general,
  1038.       however, base64 is preferred over quoted-printable for binary
  1039.       data.
  1040.  
  1041.       Note that many implementations may elect to encode the local
  1042.       representation of various content types directly, as described in
  1043.       Appendix G.  In particular, this may apply to plain text material
  1044.       on systems that use newline conventions other than CRLF
  1045.       delimiters. Such an implementation is permissible, but the
  1046.       generation of line breaks must be generalized to account for the
  1047.       case where alternate representations of newline sequences are
  1048.       used.
  1049.  
  1050.       Rule #5 (Soft Line Breaks): The Quoted-Printable encoding REQUIRES
  1051.       that encoded lines be no more than 76 characters long. If longer
  1052.       lines are to be encoded with the Quoted-Printable encoding, 'soft'
  1053.       line breaks must be used. An equal sign as the last character on a
  1054.       encoded line indicates such a non-significant ('soft') line break
  1055.       in the encoded text. Thus if the "raw" form of the line is a
  1056.       single unencoded line that says:
  1057.  
  1058.           Now's the time for all folk to come to the aid of
  1059.           their country.
  1060.  
  1061.       This can be represented, in the Quoted-Printable encoding, as
  1062.  
  1063.  
  1064.  
  1065.  
  1066. Borenstein & Freed                                             [Page 19]
  1067.  
  1068. RFC 1521                          MIME                    September 1993
  1069.  
  1070.  
  1071.           Now's the time =
  1072.           for all folk to come=
  1073.            to the aid of their country.
  1074.  
  1075.       This provides a mechanism with which long lines are encoded in
  1076.       such a way as to be restored by the user agent.  The 76 character
  1077.       limit does not count the trailing CRLF, but counts all other
  1078.       characters, including any equal signs.
  1079.  
  1080.    Since the hyphen character ("-") is represented as itself in the
  1081.    Quoted-Printable encoding, care must be taken, when encapsulating a
  1082.    quoted-printable encoded body in a multipart entity, to ensure that
  1083.    the encapsulation boundary does not appear anywhere in the encoded
  1084.    body.  (A good strategy is to choose a boundary that includes a
  1085.    character sequence such as "=_" which can never appear in a quoted-
  1086.    printable body.  See the definition of multipart messages later in
  1087.    this document.)
  1088.  
  1089.       NOTE: The quoted-printable encoding represents something of a
  1090.       compromise between readability and reliability in transport.
  1091.       Bodies encoded with the quoted-printable encoding will work
  1092.       reliably over most mail gateways, but may not work perfectly over
  1093.       a few gateways, notably those involving translation into EBCDIC.
  1094.       (In theory, an EBCDIC gateway could decode a quoted-printable body
  1095.       and re-encode it using base64, but such gateways do not yet
  1096.       exist.)  A higher level of confidence is offered by the base64
  1097.       Content-Transfer-Encoding.  A way to get reasonably reliable
  1098.       transport through EBCDIC gateways is to also quote the ASCII
  1099.       characters
  1100.  
  1101.              !"#$@[\]^`{|}~
  1102.  
  1103.       according to rule #1.  See Appendix B for more information.
  1104.  
  1105.    Because quoted-printable data is generally assumed to be line-
  1106.    oriented, it is to be expected that the representation of the breaks
  1107.    between the lines of quoted printable data may be altered in
  1108.    transport, in the same manner that plain text mail has always been
  1109.    altered in Internet mail when passing between systems with differing
  1110.    newline conventions.  If such alterations are likely to constitute a
  1111.    corruption of the data, it is probably more sensible to use the
  1112.    base64 encoding rather than the quoted-printable encoding.
  1113.  
  1114.    WARNING TO IMPLEMENTORS: If binary data are encoded in quoted-
  1115.    printable, care must be taken to encode CR and LF characters as "=0D"
  1116.    and "=0A", respectively.  In particular, a CRLF sequence in binary
  1117.    data should be encoded as "=0D=0A".  Otherwise, if CRLF were
  1118.    represented as a hard line break, it might be incorrectly decoded on
  1119.  
  1120.  
  1121.  
  1122. Borenstein & Freed                                             [Page 20]
  1123.  
  1124. RFC 1521                          MIME                    September 1993
  1125.  
  1126.  
  1127.    platforms with different line break conventions.
  1128.  
  1129.    For formalists, the syntax of quoted-printable data is described by
  1130.    the following grammar:
  1131.  
  1132.    quoted-printable := ([*(ptext / SPACE / TAB) ptext] ["="] CRLF)
  1133.         ; Maximum line length of 76 characters excluding CRLF
  1134.  
  1135.    ptext := octet /<any ASCII character except "=", SPACE, or TAB>
  1136.         ; characters not listed as "mail-safe" in Appendix B
  1137.         ; are also not recommended.
  1138.  
  1139.    octet := "=" 2(DIGIT / "A" / "B" / "C" / "D" / "E" / "F")
  1140.         ; octet must be used for characters > 127, =, SPACE, or TAB,
  1141.         ; and is recommended for any characters not listed in
  1142.         ; Appendix B as "mail-safe".
  1143.  
  1144. 5.2.  Base64 Content-Transfer-Encoding
  1145.  
  1146.    The Base64 Content-Transfer-Encoding is designed to represent
  1147.    arbitrary sequences of octets in a form that need not be humanly
  1148.    readable.  The encoding and decoding algorithms are simple, but the
  1149.    encoded data are consistently only about 33 percent larger than the
  1150.    unencoded data.  This encoding is virtually identical to the one used
  1151.    in Privacy Enhanced Mail (PEM) applications, as defined in RFC 1421.
  1152.    The base64 encoding is adapted from RFC 1421, with one change: base64
  1153.    eliminates the "*" mechanism for embedded clear text.
  1154.  
  1155.    A 65-character subset of US-ASCII is used, enabling 6 bits to be
  1156.    represented per printable character. (The extra 65th character, "=",
  1157.    is used to signify a special processing function.)
  1158.  
  1159.       NOTE: This subset has the important property that it is
  1160.       represented identically in all versions of ISO 646, including US
  1161.       ASCII, and all characters in the subset are also represented
  1162.       identically in all versions of EBCDIC.  Other popular encodings,
  1163.       such as the encoding used by the uuencode utility and the base85
  1164.       encoding specified as part of Level 2 PostScript, do not share
  1165.       these properties, and thus do not fulfill the portability
  1166.       requirements a binary transport encoding for mail must meet.
  1167.  
  1168.    The encoding process represents 24-bit groups of input bits as output
  1169.    strings of 4 encoded characters. Proceeding from left to right, a
  1170.    24-bit input group is formed by concatenating 3 8-bit input groups.
  1171.    These 24 bits are then treated as 4 concatenated 6-bit groups, each
  1172.    of which is translated into a single digit in the base64 alphabet.
  1173.    When encoding a bit stream via the base64 encoding, the bit stream
  1174.    must be presumed to be ordered with the most-significant-bit first.
  1175.  
  1176.  
  1177.  
  1178. Borenstein & Freed                                             [Page 21]
  1179.  
  1180. RFC 1521                          MIME                    September 1993
  1181.  
  1182.  
  1183.    That is, the first bit in the stream will be the high-order bit in
  1184.    the first byte, and the eighth bit will be the low-order bit in the
  1185.    first byte, and so on.
  1186.  
  1187.    Each 6-bit group is used as an index into an array of 64 printable
  1188.    characters. The character referenced by the index is placed in the
  1189.    output string. These characters, identified in Table 1, below, are
  1190.    selected so as to be universally representable, and the set excludes
  1191.    characters with particular significance to SMTP (e.g., ".", CR, LF)
  1192.    and to the encapsulation boundaries defined in this document (e.g.,
  1193.    "-").
  1194.  
  1195.                             Table 1: The Base64 Alphabet
  1196.  
  1197.       Value Encoding  Value Encoding  Value Encoding  Value Encoding
  1198.            0 A            17 R            34 i            51 z
  1199.            1 B            18 S            35 j            52 0
  1200.            2 C            19 T            36 k            53 1
  1201.            3 D            20 U            37 l            54 2
  1202.            4 E            21 V            38 m            55 3
  1203.            5 F            22 W            39 n            56 4
  1204.            6 G            23 X            40 o            57 5
  1205.            7 H            24 Y            41 p            58 6
  1206.            8 I            25 Z            42 q            59 7
  1207.            9 J            26 a            43 r            60 8
  1208.           10 K            27 b            44 s            61 9
  1209.           11 L            28 c            45 t            62 +
  1210.           12 M            29 d            46 u            63 /
  1211.           13 N            30 e            47 v
  1212.           14 O            31 f            48 w         (pad) =
  1213.           15 P            32 g            49 x
  1214.           16 Q            33 h            50 y
  1215.  
  1216.    The output stream (encoded bytes) must be represented in lines of no
  1217.    more than 76 characters each.  All line breaks or other characters
  1218.    not found in Table 1 must be ignored by decoding software.  In base64
  1219.    data, characters other than those in Table 1, line breaks, and other
  1220.    white space probably indicate a transmission error, about which a
  1221.    warning message or even a message rejection might be appropriate
  1222.    under some circumstances.
  1223.  
  1224.    Special processing is performed if fewer than 24 bits are available
  1225.    at the end of the data being encoded.  A full encoding quantum is
  1226.    always completed at the end of a body.  When fewer than 24 input bits
  1227.    are available in an input group, zero bits are added (on the right)
  1228.    to form an integral number of 6-bit groups.  Padding at the end of
  1229.    the data is performed using the '=' character.  Since all base64
  1230.    input is an integral number of octets, only the following cases can
  1231.  
  1232.  
  1233.  
  1234. Borenstein & Freed                                             [Page 22]
  1235.  
  1236. RFC 1521                          MIME                    September 1993
  1237.  
  1238.  
  1239.    arise: (1) the final quantum of encoding input is an integral
  1240.    multiple of 24 bits; here, the final unit of encoded output will be
  1241.    an integral multiple of 4 characters with no "=" padding, (2) the
  1242.    final quantum of encoding input is exactly 8 bits; here, the final
  1243.    unit of encoded output will be two characters followed by two "="
  1244.    padding characters, or (3) the final quantum of encoding input is
  1245.    exactly 16 bits; here, the final unit of encoded output will be three
  1246.    characters followed by one "=" padding character.
  1247.  
  1248.    Because it is used only for padding at the end of the data, the
  1249.    occurrence of any '=' characters may be taken as evidence that the
  1250.    end of the data has been reached (without truncation in transit).  No
  1251.    such assurance is possible, however, when the number of octets
  1252.    transmitted was a multiple of three.
  1253.  
  1254.    Any characters outside of the base64 alphabet are to be ignored in
  1255.    base64-encoded data.  The same applies to any illegal sequence of
  1256.    characters in the base64 encoding, such as "====="
  1257.  
  1258.    Care must be taken to use the proper octets for line breaks if base64
  1259.    encoding is applied directly to text material that has not been
  1260.    converted to canonical form.  In particular, text line breaks must be
  1261.    converted into CRLF sequences prior to base64 encoding. The important
  1262.    thing to note is that this may be done directly by the encoder rather
  1263.    than in a prior canonicalization step in some implementations.
  1264.  
  1265.       NOTE: There is no need to worry about quoting apparent
  1266.       encapsulation boundaries within base64-encoded parts of multipart
  1267.       entities because no hyphen characters are used in the base64
  1268.       encoding.
  1269.  
  1270. 6.    Additional Content-Header Fields
  1271.  
  1272. 6.1.  Optional Content-ID Header Field
  1273.  
  1274.    In constructing a high-level user agent, it may be desirable to allow
  1275.    one body to make reference to another.  Accordingly, bodies may be
  1276.    labeled using the "Content-ID" header field, which is syntactically
  1277.    identical to the "Message-ID" header field:
  1278.  
  1279.    id :=  "Content-ID" ":" msg-id
  1280.    Like the Message-ID values, Content-ID values must be generated to be
  1281.    world-unique.
  1282.  
  1283.    The Content-ID value may be used for uniquely identifying MIME
  1284.    entities in several contexts, particularly for cacheing data
  1285.    referenced by the message/external-body mechanism.  Although the
  1286.    Content-ID header is generally optional, its use is mandatory in
  1287.  
  1288.  
  1289.  
  1290. Borenstein & Freed                                             [Page 23]
  1291.  
  1292. RFC 1521                          MIME                    September 1993
  1293.  
  1294.  
  1295.    implementations which generate data of the optional MIME Content-type
  1296.    "message/external-body".  That is, each message/external-body entity
  1297.    must have a Content-ID field to permit cacheing of such data.
  1298.  
  1299.    It is also worth noting that the Content-ID value has special
  1300.    semantics in the case of the multipart/alternative content-type.
  1301.    This is explained in the section of this document dealing with
  1302.    multipart/alternative.
  1303.  
  1304. 6.2.  Optional Content-Description Header Field
  1305.  
  1306.    The ability to associate some descriptive information with a given
  1307.    body is often desirable. For example, it may be useful to mark an
  1308.    "image" body as "a picture of the Space Shuttle Endeavor."  Such text
  1309.    may be placed in the Content-Description header field.
  1310.  
  1311.    description := "Content-Description" ":" *text
  1312.  
  1313.    The description is presumed to be given in the US-ASCII character
  1314.    set, although the mechanism specified in [RFC-1522] may be used for
  1315.    non-US-ASCII Content-Description values.
  1316.  
  1317. 7.    The Predefined Content-Type Values
  1318.  
  1319.    This document defines seven initial Content-Type values and an
  1320.    extension mechanism for private or experimental types.  Further
  1321.    standard types must be defined by new published specifications.  It
  1322.    is expected that most innovation in new types of mail will take place
  1323.    as subtypes of the seven types defined here.  The most essential
  1324.    characteristics of the seven content-types are summarized in Appendix
  1325.    F.
  1326.  
  1327. 7.1  The Text Content-Type
  1328.  
  1329.    The text Content-Type is intended for sending material which is
  1330.    principally textual in form.  It is the default Content-Type.  A
  1331.    "charset" parameter may be used to indicate the character set of the
  1332.    body text for some text subtypes, notably including the primary
  1333.    subtype, "text/plain", which indicates plain (unformatted) text.  The
  1334.    default Content-Type for Internet mail is "text/plain; charset=us-
  1335.    ascii".
  1336.  
  1337.    Beyond plain text, there are many formats for representing what might
  1338.    be known as "extended text" -- text with embedded formatting and
  1339.    presentation information.  An interesting characteristic of many such
  1340.    representations is that they are to some extent readable even without
  1341.    the software that interprets them.  It is useful, then, to
  1342.    distinguish them, at the highest level, from such unreadable data as
  1343.  
  1344.  
  1345.  
  1346. Borenstein & Freed                                             [Page 24]
  1347.  
  1348. RFC 1521                          MIME                    September 1993
  1349.  
  1350.  
  1351.    images, audio, or text represented in an unreadable form.  In the
  1352.    absence of appropriate interpretation software, it is reasonable to
  1353.    show subtypes of text to the user, while it is not reasonable to do
  1354.    so with most nontextual data.
  1355.  
  1356.    Such formatted textual data should be represented using subtypes of
  1357.    text.  Plausible subtypes of text are typically given by the common
  1358.    name of the representation format, e.g., "text/richtext" [RFC-1341].
  1359.  
  1360. 7.1.1.     The charset parameter
  1361.  
  1362.    A critical parameter that may be specified in the Content-Type field
  1363.    for text/plain data is the character set.  This is specified with a
  1364.    "charset" parameter, as in:
  1365.  
  1366.         Content-type: text/plain; charset=us-ascii
  1367.  
  1368.    Unlike some other parameter values, the values of the charset
  1369.    parameter are NOT case sensitive.  The default character set, which
  1370.    must be assumed in the absence of a charset parameter, is US-ASCII.
  1371.  
  1372.    The specification for any future subtypes of "text" must specify
  1373.    whether or not they will also utilize a "charset" parameter, and may
  1374.    possibly restrict its values as well.  When used with a particular
  1375.    body, the semantics of the "charset" parameter should be identical to
  1376.    those specified here for "text/plain", i.e., the body consists
  1377.    entirely of characters in the given charset.  In particular, definers
  1378.    of future text subtypes should pay close attention the the
  1379.    implications of multibyte character sets for their subtype
  1380.    definitions.
  1381.  
  1382.    This RFC specifies the definition of the charset parameter for the
  1383.    purposes of MIME to be a unique mapping of a byte stream to glyphs, a
  1384.    mapping which does not require external profiling information.
  1385.  
  1386.    An initial list of predefined character set names can be found at the
  1387.    end of this section.  Additional character sets may be registered
  1388.    with IANA, although the standardization of their use requires the
  1389.    usual IESG [RFC-1340] review and approval.  Note that if the
  1390.    specified character set includes 8-bit data, a Content-Transfer-
  1391.    Encoding header field and a corresponding encoding on the data are
  1392.    required in order to transmit the body via some mail transfer
  1393.    protocols, such as SMTP.
  1394.  
  1395.    The default character set, US-ASCII, has been the subject of some
  1396.    confusion and ambiguity in the past.  Not only were there some
  1397.    ambiguities in the definition, there have been wide variations in
  1398.    practice.  In order to eliminate such ambiguity and variations in the
  1399.  
  1400.  
  1401.  
  1402. Borenstein & Freed                                             [Page 25]
  1403.  
  1404. RFC 1521                          MIME                    September 1993
  1405.  
  1406.  
  1407.    future, it is strongly recommended that new user agents explicitly
  1408.    specify a character set via the Content-Type header field.  "US-
  1409.    ASCII" does not indicate an arbitrary seven-bit character code, but
  1410.    specifies that the body uses character coding that uses the exact
  1411.    correspondence of codes to characters specified in ASCII.  National
  1412.    use variations of ISO 646 [ISO-646] are NOT ASCII and their use in
  1413.    Internet mail is explicitly discouraged. The omission of the ISO 646
  1414.    character set is deliberate in this regard.  The character set name
  1415.    of "US-ASCII" explicitly refers to ANSI X3.4-1986 [US-ASCII] only.
  1416.    The character set name "ASCII" is reserved and must not be used for
  1417.    any purpose.
  1418.  
  1419.       NOTE: RFC 821 explicitly specifies "ASCII", and references an
  1420.       earlier version of the American Standard.  Insofar as one of the
  1421.       purposes of specifying a Content-Type and character set is to
  1422.       permit the receiver to unambiguously determine how the sender
  1423.       intended the coded message to be interpreted, assuming anything
  1424.       other than "strict ASCII" as the default would risk unintentional
  1425.       and incompatible changes to the semantics of messages now being
  1426.       transmitted.  This also implies that messages containing
  1427.       characters coded according to national variations on ISO 646, or
  1428.       using code-switching procedures (e.g., those of ISO 2022), as well
  1429.       as 8-bit or multiple octet character encodings MUST use an
  1430.       appropriate character set specification to be consistent with this
  1431.       specification.
  1432.  
  1433.    The complete US-ASCII character set is listed in [US-ASCII].  Note
  1434.    that the control characters including DEL (0-31, 127) have no defined
  1435.    meaning apart from the combination CRLF (ASCII values 13 and 10)
  1436.    indicating a new line.  Two of the characters have de facto meanings
  1437.    in wide use: FF (12) often means "start subsequent text on the
  1438.    beginning of a new page"; and TAB or HT (9) often (though not always)
  1439.    means "move the cursor to the next available column after the current
  1440.    position where the column number is a multiple of 8 (counting the
  1441.    first column as column 0)." Apart from this, any use of the control
  1442.    characters or DEL in a body must be part of a private agreement
  1443.    between the sender and recipient.  Such private agreements are
  1444.    discouraged and should be replaced by the other capabilities of this
  1445.    document.
  1446.  
  1447.       NOTE: Beyond US-ASCII, an enormous proliferation of character sets
  1448.       is possible. It is the opinion of the IETF working group that a
  1449.       large number of character sets is NOT a good thing.  We would
  1450.       prefer to specify a single character set that can be used
  1451.       universally for representing all of the world's languages in
  1452.       electronic mail.  Unfortunately, existing practice in several
  1453.       communities seems to point to the continued use of multiple
  1454.       character sets in the near future.  For this reason, we define
  1455.  
  1456.  
  1457.  
  1458. Borenstein & Freed                                             [Page 26]
  1459.  
  1460. RFC 1521                          MIME                    September 1993
  1461.  
  1462.  
  1463.       names for a small number of character sets for which a strong
  1464.       constituent base exists.
  1465.  
  1466.    The defined charset values are:
  1467.  
  1468.    US-ASCII -- as defined in [US-ASCII].
  1469.  
  1470.         ISO-8859-X -- where "X" is to be replaced, as necessary, for the
  1471.              parts of ISO-8859 [ISO-8859].  Note that the ISO 646
  1472.              character sets have deliberately been omitted in favor of
  1473.              their 8859 replacements, which are the designated character
  1474.              sets for Internet mail.  As of the publication of this
  1475.              document, the legitimate values for "X" are the digits 1
  1476.              through 9.
  1477.  
  1478.    The character sets specified above are the ones that were relatively
  1479.    uncontroversial during the drafting of MIME.  This document does not
  1480.    endorse the use of any particular character set other than US-ASCII,
  1481.    and recognizes that the future evolution of world character sets
  1482.    remains unclear.  It is expected that in the future, additional
  1483.    character sets will be registered for use in MIME.
  1484.  
  1485.    Note that the character set used, if anything other than US-ASCII,
  1486.    must always be explicitly specified in the Content-Type field.
  1487.  
  1488.    No other character set name may be used in Internet mail without the
  1489.    publication of a formal specification and its registration with IANA,
  1490.    or by private agreement, in which case the character set name must
  1491.    begin with "X-".
  1492.  
  1493.    Implementors are discouraged from defining new character sets for
  1494.    mail use unless absolutely necessary.
  1495.  
  1496.    The "charset" parameter has been defined primarily for the purpose of
  1497.    textual data, and is described in this section for that reason.
  1498.    However, it is conceivable that non-textual data might also wish to
  1499.    specify a charset value for some purpose, in which case the same
  1500.    syntax and values should be used.
  1501.  
  1502.    In general, mail-sending software must always use the "lowest common
  1503.    denominator" character set possible.  For example, if a body contains
  1504.    only US-ASCII characters, it must be marked as being in the US-ASCII
  1505.    character set, not ISO-8859-1, which, like all the ISO-8859 family of
  1506.    character sets, is a superset of US-ASCII.  More generally, if a
  1507.    widely-used character set is a subset of another character set, and a
  1508.    body contains only characters in the widely-used subset, it must be
  1509.    labeled as being in that subset.  This will increase the chances that
  1510.    the recipient will be able to view the mail correctly.
  1511.  
  1512.  
  1513.  
  1514. Borenstein & Freed                                             [Page 27]
  1515.  
  1516. RFC 1521                          MIME                    September 1993
  1517.  
  1518.  
  1519. 7.1.2.     The Text/plain subtype
  1520.  
  1521.    The primary subtype of text is "plain".  This indicates plain
  1522.    (unformatted) text.  The default Content-Type for Internet mail,
  1523.    "text/plain; charset=us-ascii", describes existing Internet practice.
  1524.    That is, it is the type of body defined by RFC 822.
  1525.  
  1526.    No other text subtype is defined by this document.
  1527.  
  1528.    The formal grammar for the content-type header field for text is as
  1529.    follows:
  1530.  
  1531.    text-type := "text" "/" text-subtype [";" "charset" "=" charset]
  1532.  
  1533.    text-subtype := "plain" / extension-token
  1534.  
  1535.    charset := "us-ascii"/ "iso-8859-1"/ "iso-8859-2"/ "iso-8859-3"
  1536.           / "iso-8859-4"/ "iso-8859-5"/ "iso-8859-6"/ "iso-8859-7"
  1537.           / "iso-8859-8" / "iso-8859-9" / extension-token
  1538.                     ; case insensitive
  1539.  
  1540. 7.2.  The Multipart Content-Type
  1541.  
  1542.    In the case of multiple part entities, in which one or more different
  1543.    sets of data are combined in a single body, a "multipart" Content-
  1544.    Type field must appear in the entity's header. The body must then
  1545.    contain one or more "body parts," each preceded by an encapsulation
  1546.    boundary, and the last one followed by a closing boundary.  Each part
  1547.    starts with an encapsulation boundary, and then contains a body part
  1548.    consisting of header area, a blank line, and a body area.  Thus a
  1549.    body part is similar to an RFC 822 message in syntax, but different
  1550.    in meaning.
  1551.  
  1552.    A body part is NOT to be interpreted as actually being an RFC 822
  1553.    message.  To begin with, NO header fields are actually required in
  1554.    body parts.  A body part that starts with a blank line, therefore, is
  1555.    allowed and is a body part for which all default values are to be
  1556.    assumed.  In such a case, the absence of a Content-Type header field
  1557.    implies that the corresponding body is plain US-ASCII text.  The only
  1558.    header fields that have defined meaning for body parts are those the
  1559.    names of which begin with "Content-".  All other header fields are
  1560.    generally to be ignored in body parts.  Although they should
  1561.    generally be retained in mail processing, they may be discarded by
  1562.    gateways if necessary.  Such other fields are permitted to appear in
  1563.    body parts but must not be depended on.  "X-" fields may be created
  1564.    for experimental or private purposes, with the recognition that the
  1565.    information they contain may be lost at some gateways.
  1566.  
  1567.  
  1568.  
  1569.  
  1570. Borenstein & Freed                                             [Page 28]
  1571.  
  1572. RFC 1521                          MIME                    September 1993
  1573.  
  1574.  
  1575.       NOTE: The distinction between an RFC 822 message and a body part
  1576.       is subtle, but important. A gateway between Internet and X.400
  1577.       mail, for example, must be able to tell the difference between a
  1578.       body part that contains an image and a body part that contains an
  1579.       encapsulated message, the body of which is an image.  In order to
  1580.       represent the latter, the body part must have "Content-Type:
  1581.       message", and its body (after the blank line) must be the
  1582.       encapsulated message, with its own "Content-Type: image" header
  1583.       field.  The use of similar syntax facilitates the conversion of
  1584.       messages to body parts, and vice versa, but the distinction
  1585.       between the two must be understood by implementors.  (For the
  1586.       special case in which all parts actually are messages, a "digest"
  1587.       subtype is also defined.)
  1588.  
  1589.    As stated previously, each body part is preceded by an encapsulation
  1590.    boundary.  The encapsulation boundary MUST NOT appear inside any of
  1591.    the encapsulated parts.  Thus, it is crucial that the composing agent
  1592.    be able to choose and specify the unique boundary that will separate
  1593.    the parts.
  1594.  
  1595.    All present and future subtypes of the "multipart" type must use an
  1596.    identical syntax.  Subtypes may differ in their semantics, and may
  1597.    impose additional restrictions on syntax, but must conform to the
  1598.    required syntax for the multipart type.  This requirement ensures
  1599.    that all conformant user agents will at least be able to recognize
  1600.    and separate the parts of any multipart entity, even of an
  1601.    unrecognized subtype.
  1602.  
  1603.    As stated in the definition of the Content-Transfer-Encoding field,
  1604.    no encoding other than "7bit", "8bit", or "binary" is permitted for
  1605.    entities of type "multipart".  The multipart delimiters and header
  1606.    fields are always represented as 7-bit ASCII in any case (though the
  1607.    header fields may encode non-ASCII header text as per [RFC-1522]),
  1608.    and data within the body parts can be encoded on a part-by-part
  1609.    basis, with Content-Transfer-Encoding fields for each appropriate
  1610.    body part.
  1611.  
  1612.    Mail gateways, relays, and other mail handling agents are commonly
  1613.    known to alter the top-level header of an RFC 822 message.  In
  1614.    particular, they frequently add, remove, or reorder header fields.
  1615.    Such alterations are explicitly forbidden for the body part headers
  1616.    embedded in the bodies of messages of type "multipart."
  1617.  
  1618. 7.2.1.     Multipart:  The common syntax
  1619.  
  1620.    All subtypes of "multipart" share a common syntax, defined in this
  1621.    section.  A simple example of a multipart message also appears in
  1622.    this section.  An example of a more complex multipart message is
  1623.  
  1624.  
  1625.  
  1626. Borenstein & Freed                                             [Page 29]
  1627.  
  1628. RFC 1521                          MIME                    September 1993
  1629.  
  1630.  
  1631.    given in Appendix C.
  1632.  
  1633.    The Content-Type field for multipart entities requires one parameter,
  1634.    "boundary", which is used to specify the encapsulation boundary.  The
  1635.    encapsulation boundary is defined as a line consisting entirely of
  1636.    two hyphen characters ("-", decimal code 45) followed by the boundary
  1637.    parameter value from the Content-Type header field.
  1638.  
  1639.       NOTE: The hyphens are for rough compatibility with the earlier RFC
  1640.       934 method of message encapsulation, and for ease of searching for
  1641.       the boundaries in some implementations. However, it should be
  1642.       noted that multipart messages are NOT completely compatible with
  1643.       RFC 934 encapsulations; in particular, they do not obey RFC 934
  1644.       quoting conventions for embedded lines that begin with hyphens.
  1645.       This mechanism was chosen over the RFC 934 mechanism because the
  1646.       latter causes lines to grow with each level of quoting.  The
  1647.       combination of this growth with the fact that SMTP implementations
  1648.       sometimes wrap long lines made the RFC 934 mechanism unsuitable
  1649.       for use in the event that deeply-nested multipart structuring is
  1650.       ever desired.
  1651.  
  1652.    WARNING TO IMPLEMENTORS: The grammar for parameters on the Content-
  1653.    type field is such that it is often necessary to enclose the
  1654.    boundaries in quotes on the Content-type line.  This is not always
  1655.    necessary, but never hurts.  Implementors should be sure to study the
  1656.    grammar carefully in order to avoid producing illegal Content-type
  1657.    fields. Thus, a typical multipart Content-Type header field might
  1658.    look like this:
  1659.  
  1660.                  Content-Type: multipart/mixed;
  1661.                       boundary=gc0p4Jq0M2Yt08jU534c0p
  1662.  
  1663.    But the following is illegal:
  1664.  
  1665.                  Content-Type: multipart/mixed;
  1666.                       boundary=gc0p4Jq0M:2Yt08jU534c0p
  1667.  
  1668.    (because of the colon) and must instead be represented as
  1669.  
  1670.                  Content-Type: multipart/mixed;
  1671.                       boundary="gc0p4Jq0M:2Yt08jU534c0p"
  1672.  
  1673.    This indicates that the entity consists of several parts, each itself
  1674.    with a structure that is syntactically identical to an RFC 822
  1675.    message, except that the header area might be completely empty, and
  1676.    that the parts are each preceded by the line
  1677.  
  1678.                  --gc0p4Jq0M:2Yt08jU534c0p
  1679.  
  1680.  
  1681.  
  1682. Borenstein & Freed                                             [Page 30]
  1683.  
  1684. RFC 1521                          MIME                    September 1993
  1685.  
  1686.  
  1687.    Note that the encapsulation boundary must occur at the beginning of a
  1688.    line, i.e., following a CRLF, and that the initial CRLF is considered
  1689.    to be attached to the encapsulation boundary rather than part of the
  1690.    preceding part.  The boundary must be followed immediately either by
  1691.    another CRLF and the header fields for the next part, or by two
  1692.    CRLFs, in which case there are no header fields for the next part
  1693.    (and it is therefore assumed to be of Content-Type text/plain).
  1694.  
  1695.       NOTE: The CRLF preceding the encapsulation line is conceptually
  1696.       attached to the boundary so that it is possible to have a part
  1697.       that does not end with a CRLF (line break). Body parts that must
  1698.       be considered to end with line breaks, therefore, must have two
  1699.       CRLFs preceding the encapsulation line, the first of which is part
  1700.       of the preceding body part, and the second of which is part of the
  1701.       encapsulation boundary.
  1702.  
  1703.    Encapsulation boundaries must not appear within the encapsulations,
  1704.    and must be no longer than 70 characters, not counting the two
  1705.    leading hyphens.
  1706.  
  1707.    The encapsulation boundary following the last body part is a
  1708.    distinguished delimiter that indicates that no further body parts
  1709.    will follow.  Such a delimiter is identical to the previous
  1710.    delimiters, with the addition of two more hyphens at the end of the
  1711.    line:
  1712.  
  1713.                  --gc0p4Jq0M2Yt08jU534c0p--
  1714.  
  1715.    There appears to be room for additional information prior to the
  1716.    first encapsulation boundary and following the final boundary.  These
  1717.    areas should generally be left blank, and implementations must ignore
  1718.    anything that appears before the first boundary or after the last
  1719.    one.
  1720.  
  1721.       NOTE: These "preamble" and "epilogue" areas are generally not used
  1722.       because of the lack of proper typing of these parts and the lack
  1723.       of clear semantics for handling these areas at gateways,
  1724.       particularly X.400 gateways.  However, rather than leaving the
  1725.       preamble area blank, many MIME implementations have found this to
  1726.       be a convenient place to insert an explanatory note for recipients
  1727.       who read the message with pre-MIME software, since such notes will
  1728.       be ignored by MIME-compliant software.
  1729.  
  1730.       NOTE: Because encapsulation boundaries must not appear in the body
  1731.       parts being encapsulated, a user agent must exercise care to
  1732.       choose a unique boundary.  The boundary in the example above could
  1733.       have been the result of an algorithm designed to produce
  1734.       boundaries with a very low probability of already existing in the
  1735.  
  1736.  
  1737.  
  1738. Borenstein & Freed                                             [Page 31]
  1739.  
  1740. RFC 1521                          MIME                    September 1993
  1741.  
  1742.  
  1743.       data to be encapsulated without having to prescan the data.
  1744.       Alternate algorithms might result in more 'readable' boundaries
  1745.       for a recipient with an old user agent, but would require more
  1746.       attention to the possibility that the boundary might appear in the
  1747.       encapsulated part.  The simplest boundary possible is something
  1748.       like "---", with a closing boundary of "-----".
  1749.  
  1750.    As a very simple example, the following multipart message has two
  1751.    parts, both of them plain text, one of them explicitly typed and one
  1752.    of them implicitly typed:
  1753.  
  1754.       From: Nathaniel Borenstein <nsb@bellcore.com>
  1755.       To:  Ned Freed <ned@innosoft.com>
  1756.       Subject: Sample message
  1757.       MIME-Version: 1.0
  1758.       Content-type: multipart/mixed; boundary="simple
  1759.       boundary"
  1760.  
  1761.       This is the preamble.  It is to be ignored, though it
  1762.       is a handy place for mail composers to include an
  1763.       explanatory note to non-MIME conformant readers.
  1764.       --simple boundary
  1765.  
  1766.       This is implicitly typed plain ASCII text.
  1767.       It does NOT end with a linebreak.
  1768.       --simple boundary
  1769.       Content-type: text/plain; charset=us-ascii
  1770.  
  1771.       This is explicitly typed plain ASCII text.
  1772.       It DOES end with a linebreak.
  1773.  
  1774.       --simple boundary--
  1775.       This is the epilogue.  It is also to be ignored.
  1776.  
  1777.    The use of a Content-Type of multipart in a body part within another
  1778.    multipart entity is explicitly allowed.  In such cases, for obvious
  1779.    reasons, care must be taken to ensure that each nested multipart
  1780.    entity must use a different boundary delimiter. See Appendix C for an
  1781.    example of nested multipart entities.
  1782.  
  1783.    The use of the multipart Content-Type with only a single body part
  1784.    may be useful in certain contexts, and is explicitly permitted.
  1785.  
  1786.    The only mandatory parameter for the multipart Content-Type is the
  1787.    boundary parameter, which consists of 1 to 70 characters from a set
  1788.    of characters known to be very robust through email gateways, and NOT
  1789.    ending with white space.  (If a boundary appears to end with white
  1790.    space, the white space must be presumed to have been added by a
  1791.  
  1792.  
  1793.  
  1794. Borenstein & Freed                                             [Page 32]
  1795.  
  1796. RFC 1521                          MIME                    September 1993
  1797.  
  1798.  
  1799.    gateway, and must be deleted.)  It is formally specified by the
  1800.    following BNF:
  1801.  
  1802.    boundary := 0*69<bchars> bcharsnospace
  1803.  
  1804.    bchars := bcharsnospace / " "
  1805.  
  1806.    bcharsnospace :=    DIGIT / ALPHA / "'" / "(" / ")" / "+" /"_"
  1807.                  / "," / "-" / "." / "/" / ":" / "=" / "?"
  1808.  
  1809.    Overall, the body of a multipart entity may be specified  as
  1810.    follows:
  1811.  
  1812.    multipart-body := preamble 1*encapsulation
  1813.                   close-delimiter epilogue
  1814.  
  1815.    encapsulation := delimiter body-part CRLF
  1816.  
  1817.    delimiter := "--" boundary CRLF ; taken from Content-Type field.
  1818.                                    ; There must be no space
  1819.                                    ; between "--" and boundary.
  1820.  
  1821.    close-delimiter := "--" boundary "--" CRLF ; Again, no space
  1822.    by "--",
  1823.  
  1824.    preamble := discard-text   ;  to  be  ignored upon receipt.
  1825.  
  1826.    epilogue := discard-text   ;  to  be  ignored upon receipt.
  1827.  
  1828.    discard-text := *(*text CRLF)
  1829.  
  1830.    body-part := <"message" as defined in RFC 822,
  1831.              with all header fields optional, and with the
  1832.              specified delimiter not occurring anywhere in
  1833.              the message body, either on a line by itself
  1834.              or as a substring anywhere.  Note that the
  1835.              semantics of a part differ from the semantics
  1836.              of a message, as described in the text.>
  1837.  
  1838.       NOTE: In certain transport enclaves, RFC 822 restrictions such as
  1839.       the one that limits bodies to printable ASCII characters may not
  1840.       be in force.  (That is, the transport domains may resemble
  1841.       standard Internet mail transport as specified in RFC821 and
  1842.       assumed by RFC822, but without certain restrictions.)  The
  1843.       relaxation of these restrictions should be construed as locally
  1844.       extending the definition of bodies, for example to include octets
  1845.       outside of the ASCII range, as long as these extensions are
  1846.       supported by the transport and adequately documented in the
  1847.  
  1848.  
  1849.  
  1850. Borenstein & Freed                                             [Page 33]
  1851.  
  1852. RFC 1521                          MIME                    September 1993
  1853.  
  1854.  
  1855.       Content-Transfer-Encoding header field. However, in no event are
  1856.       headers (either message headers or body-part headers) allowed to
  1857.       contain anything other than ASCII characters.
  1858.  
  1859.       NOTE: Conspicuously missing from the multipart type is a notion of
  1860.       structured, related body parts.  In general, it seems premature to
  1861.       try to standardize interpart structure yet.  It is recommended
  1862.       that those wishing to provide a more structured or integrated
  1863.       multipart messaging facility should define a subtype of multipart
  1864.       that is syntactically identical, but that always expects the
  1865.       inclusion of a distinguished part that can be used to specify the
  1866.       structure and integration of the other parts, probably referring
  1867.       to them by their Content-ID field.  If this approach is used,
  1868.       other implementations will not recognize the new subtype, but will
  1869.       treat it as the primary subtype (multipart/mixed) and will thus be
  1870.       able to show the user the parts that are recognized.
  1871.  
  1872. 7.2.2.     The Multipart/mixed (primary) subtype
  1873.  
  1874.    The primary subtype for multipart, "mixed", is intended for use when
  1875.    the body parts are independent and need to be bundled in a particular
  1876.    order.  Any multipart subtypes that an implementation does not
  1877.    recognize must be treated as being of subtype "mixed".
  1878.  
  1879. 7.2.3.     The Multipart/alternative subtype
  1880.  
  1881.    The multipart/alternative type is syntactically identical to
  1882.    multipart/mixed, but the semantics are different.  In particular,
  1883.    each of the parts is an "alternative" version of the same
  1884.    information.
  1885.  
  1886.    Systems should recognize that the content of the various parts are
  1887.    interchangeable.  Systems should choose the "best" type based on the
  1888.    local environment and preferences, in some cases even through user
  1889.    interaction.  As with multipart/mixed, the order of body parts is
  1890.    significant.  In this case, the alternatives appear in an order of
  1891.    increasing faithfulness to the original content. In general, the best
  1892.    choice is the LAST part of a type supported by the recipient system's
  1893.    local environment.
  1894.  
  1895.    Multipart/alternative may be used, for example, to send mail in a
  1896.    fancy text format in such a way that it can easily be displayed
  1897.    anywhere:
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906. Borenstein & Freed                                             [Page 34]
  1907.  
  1908. RFC 1521                          MIME                    September 1993
  1909.  
  1910.  
  1911.    From:  Nathaniel Borenstein <nsb@bellcore.com>
  1912.    To: Ned Freed <ned@innosoft.com>
  1913.    Subject: Formatted text mail
  1914.    MIME-Version: 1.0
  1915.    Content-Type: multipart/alternative; boundary=boundary42
  1916.  
  1917.    --boundary42
  1918.  
  1919.    Content-Type: text/plain; charset=us-ascii
  1920.  
  1921.       ...plain text version of message goes here....
  1922.    --boundary42
  1923.    Content-Type: text/richtext
  1924.  
  1925.       .... RFC 1341 richtext version of same message goes here ...
  1926.    --boundary42
  1927.    Content-Type: text/x-whatever
  1928.  
  1929.       .... fanciest formatted version of same  message  goes  here
  1930.       ...
  1931.    --boundary42--
  1932.  
  1933.    In this example, users whose mail system understood the "text/x-
  1934.    whatever" format would see only the fancy version, while other users
  1935.    would see only the richtext or plain text version, depending on the
  1936.    capabilities of their system.
  1937.  
  1938.    In general, user agents that compose multipart/alternative entities
  1939.    must place the body parts in increasing order of preference, that is,
  1940.    with the preferred format last.  For fancy text, the sending user
  1941.    agent should put the plainest format first and the richest format
  1942.    last.  Receiving user agents should pick and display the last format
  1943.    they are capable of displaying.  In the case where one of the
  1944.    alternatives is itself of type "multipart" and contains unrecognized
  1945.    sub-parts, the user agent may choose either to show that alternative,
  1946.    an earlier alternative, or both.
  1947.  
  1948.       NOTE: From an implementor's perspective, it might seem more
  1949.       sensible to reverse this ordering, and have the plainest
  1950.       alternative last.  However, placing the plainest alternative first
  1951.       is the friendliest possible option when multipart/alternative
  1952.       entities are viewed using a non-MIME-conformant mail reader.
  1953.       While this approach does impose some burden on conformant mail
  1954.       readers, interoperability with older mail readers was deemed to be
  1955.       more important in this case.
  1956.  
  1957.    It may be the case that some user agents, if they can recognize more
  1958.    than one of the formats, will prefer to offer the user the choice of
  1959.  
  1960.  
  1961.  
  1962. Borenstein & Freed                                             [Page 35]
  1963.  
  1964. RFC 1521                          MIME                    September 1993
  1965.  
  1966.  
  1967.    which format to view.  This makes sense, for example, if mail
  1968.    includes both a nicely-formatted image version and an easily-edited
  1969.    text version.  What is most critical, however, is that the user not
  1970.    automatically be shown multiple versions of the same data.  Either
  1971.    the user should be shown the last recognized version or should be
  1972.    given the choice.
  1973.  
  1974.    NOTE ON THE SEMANTICS OF CONTENT-ID IN MULTIPART/ALTERNATIVE: Each
  1975.    part of a multipart/alternative entity represents the same data, but
  1976.    the mappings between the two are not necessarily without information
  1977.    loss.  For example, information is lost when translating ODA to
  1978.    PostScript or plain text.  It is recommended that each part should
  1979.    have a different Content-ID value in the case where the information
  1980.    content of the two parts is not identical.  However, where the
  1981.    information content is identical -- for example, where several parts
  1982.    of type "application/external- body" specify alternate ways to access
  1983.    the identical data -- the same Content-ID field value should be used,
  1984.    to optimize any cacheing mechanisms that might be present on the
  1985.    recipient's end.  However, it is recommended that the Content-ID
  1986.    values used by the parts should not be the same Content-ID value that
  1987.    describes the multipart/alternative as a whole, if there is any such
  1988.    Content-ID field.  That is, one Content-ID value will refer to the
  1989.    multipart/alternative entity, while one or more other Content-ID
  1990.    values will refer to the parts inside it.
  1991.  
  1992. 7.2.4.     The Multipart/digest subtype
  1993.  
  1994.    This document defines a "digest" subtype of the multipart Content-
  1995.    Type.  This type is syntactically identical to multipart/mixed, but
  1996.    the semantics are different.  In particular, in a digest, the default
  1997.    Content-Type value for a body part is changed from "text/plain" to
  1998.    "message/rfc822".  This is done to allow a more readable digest
  1999.    format that is largely compatible (except for the quoting convention)
  2000.    with RFC 934.
  2001.  
  2002.  
  2003.  
  2004.  
  2005.  
  2006.  
  2007.  
  2008.  
  2009.  
  2010.  
  2011.  
  2012.  
  2013.  
  2014.  
  2015.  
  2016.  
  2017.  
  2018. Borenstein & Freed                                             [Page 36]
  2019.  
  2020. RFC 1521                          MIME                    September 1993
  2021.  
  2022.  
  2023.    A digest in this format might, then, look something like this:
  2024.  
  2025.    From: Moderator-Address
  2026.    To: Recipient-List
  2027.    MIME-Version: 1.0
  2028.    Subject:  Internet Digest, volume 42
  2029.    Content-Type: multipart/digest;
  2030.         boundary="---- next message ----"
  2031.  
  2032.    ------ next message ----
  2033.  
  2034.    From: someone-else
  2035.    Subject: my opinion
  2036.  
  2037.       ...body goes here ...
  2038.  
  2039.    ------ next message ----
  2040.  
  2041.    From: someone-else-again
  2042.    Subject: my different opinion
  2043.  
  2044.       ... another body goes here...
  2045.  
  2046.    ------ next message ------
  2047.  
  2048. 7.2.5.     The Multipart/parallel subtype
  2049.  
  2050.    This document defines a "parallel" subtype of the multipart Content-
  2051.    Type.  This type is syntactically identical to multipart/mixed, but
  2052.    the semantics are different.  In particular, in a parallel entity,
  2053.    the order of body parts is not significant.
  2054.  
  2055.    A common presentation of this type is to display all of the parts
  2056.    simultaneously on hardware and software that are capable of doing so.
  2057.    However, composing agents should be aware that many mail readers will
  2058.    lack this capability and will show the parts serially in any event.
  2059.  
  2060. 7.2.6.     Other Multipart subtypes
  2061.  
  2062.    Other multipart subtypes are expected in the future.  MIME
  2063.    implementations must in general treat unrecognized subtypes of
  2064.    multipart as being equivalent to "multipart/mixed".
  2065.  
  2066.    The formal grammar for content-type header fields for multipart data
  2067.    is given by:
  2068.  
  2069.    multipart-type := "multipart" "/" multipart-subtype
  2070.                   ";" "boundary" "=" boundary
  2071.  
  2072.  
  2073.  
  2074. Borenstein & Freed                                             [Page 37]
  2075.  
  2076. RFC 1521                          MIME                    September 1993
  2077.  
  2078.  
  2079.    multipart-subtype := "mixed" / "parallel" / "digest"
  2080.                   / "alternative" / extension-token
  2081.  
  2082. 7.3.  The Message Content-Type
  2083.  
  2084.    It is frequently desirable, in sending mail, to encapsulate another
  2085.    mail message. For this common operation, a special Content-Type,
  2086.    "message", is defined.  The primary subtype, message/rfc822, has no
  2087.    required parameters in the Content-Type field.  Additional subtypes,
  2088.    "partial" and "External-body", do have required parameters.  These
  2089.    subtypes are explained below.
  2090.  
  2091.       NOTE: It has been suggested that subtypes of message might be
  2092.       defined for forwarded or rejected messages.  However, forwarded
  2093.       and rejected messages can be handled as multipart messages in
  2094.       which the first part contains any control or descriptive
  2095.       information, and a second part, of type message/rfc822, is the
  2096.       forwarded or rejected message.  Composing rejection and forwarding
  2097.       messages in this manner will preserve the type information on the
  2098.       original message and allow it to be correctly presented to the
  2099.       recipient, and hence is strongly encouraged.
  2100.  
  2101.    As stated in the definition of the Content-Transfer-Encoding field,
  2102.    no encoding other than "7bit", "8bit", or "binary" is permitted for
  2103.    messages or parts of type "message".  Even stronger restrictions
  2104.    apply to the subtypes "message/partial" and "message/external-body",
  2105.    as specified below.  The message header fields are always US-ASCII in
  2106.    any case, and data within the body can still be encoded, in which
  2107.    case the Content-Transfer-Encoding header field in the encapsulated
  2108.    message will reflect this.  Non-ASCII text in the headers of an
  2109.    encapsulated message can be specified using the mechanisms described
  2110.    in [RFC-1522].
  2111.  
  2112.    Mail gateways, relays, and other mail handling agents are commonly
  2113.    known to alter the top-level header of an RFC 822 message.  In
  2114.    particular, they frequently add, remove, or reorder header fields.
  2115.    Such alterations are explicitly forbidden for the encapsulated
  2116.    headers embedded in the bodies of messages of type "message."
  2117.  
  2118. 7.3.1.     The Message/rfc822 (primary) subtype
  2119.  
  2120.    A Content-Type of "message/rfc822" indicates that the body contains
  2121.    an encapsulated message, with the syntax of an RFC 822 message.
  2122.    However, unlike top-level RFC 822 messages, it is not required that
  2123.    each message/rfc822 body must include a "From", "Subject", and at
  2124.    least one destination header.
  2125.  
  2126.    It should be noted that, despite the use of the numbers "822", a
  2127.  
  2128.  
  2129.  
  2130. Borenstein & Freed                                             [Page 38]
  2131.  
  2132. RFC 1521                          MIME                    September 1993
  2133.  
  2134.  
  2135.    message/rfc822 entity can include enhanced information as defined in
  2136.    this document.  In other words, a message/rfc822 message may be a
  2137.    MIME message.
  2138.  
  2139. 7.3.2.     The Message/Partial subtype
  2140.  
  2141.    A subtype of message, "partial", is defined in order to allow large
  2142.    objects to be delivered as several separate pieces of mail and
  2143.    automatically reassembled by the receiving user agent.  (The concept
  2144.    is similar to IP fragmentation/reassembly in the basic Internet
  2145.    Protocols.)  This mechanism can be used when intermediate transport
  2146.    agents limit the size of individual messages that can be sent.
  2147.    Content-Type "message/partial" thus indicates that the body contains
  2148.    a fragment of a larger message.
  2149.  
  2150.    Three parameters must be specified in the Content-Type field of type
  2151.    message/partial: The first, "id", is a unique identifier, as close to
  2152.    a world-unique identifier as possible, to be used to match the parts
  2153.    together.  (In general, the identifier is essentially a message-id;
  2154.    if placed in double quotes, it can be any message-id, in accordance
  2155.    with the BNF for "parameter" given earlier in this specification.)
  2156.    The second, "number", an integer, is the part number, which indicates
  2157.    where this part fits into the sequence of fragments.  The third,
  2158.    "total", another integer, is the total number of parts. This third
  2159.    subfield is required on the final part, and is optional (though
  2160.    encouraged) on the earlier parts.  Note also that these parameters
  2161.    may be given in any order.
  2162.  
  2163.    Thus, part 2 of a 3-part message may have either of the following
  2164.    header fields:
  2165.  
  2166.                 Content-Type: Message/Partial;
  2167.                      number=2; total=3;
  2168.                      id="oc=jpbe0M2Yt4s@thumper.bellcore.com"
  2169.  
  2170.                 Content-Type: Message/Partial;
  2171.                      id="oc=jpbe0M2Yt4s@thumper.bellcore.com";
  2172.                      number=2
  2173.  
  2174.    But part 3 MUST specify the total number of parts:
  2175.  
  2176.                 Content-Type: Message/Partial;
  2177.                      number=3; total=3;
  2178.                      id="oc=jpbe0M2Yt4s@thumper.bellcore.com"
  2179.  
  2180.    Note that part numbering begins with 1, not 0.
  2181.  
  2182.    When the parts of a message broken up in this manner are put
  2183.  
  2184.  
  2185.  
  2186. Borenstein & Freed                                             [Page 39]
  2187.  
  2188. RFC 1521                          MIME                    September 1993
  2189.  
  2190.  
  2191.    together, the result is a complete MIME entity, which may have its
  2192.    own Content-Type header field, and thus may contain any other data
  2193.    type.
  2194.  
  2195.    Message fragmentation and reassembly: The semantics of a reassembled
  2196.    partial message must be those of the "inner" message, rather than of
  2197.    a message containing the inner message.  This makes it possible, for
  2198.    example, to send a large audio message as several partial messages,
  2199.    and still have it appear to the recipient as a simple audio message
  2200.    rather than as an encapsulated message containing an audio message.
  2201.    That is, the encapsulation of the message is considered to be
  2202.    "transparent".
  2203.  
  2204.    When generating and reassembling the parts of a message/partial
  2205.    message, the headers of the encapsulated message must be merged with
  2206.    the headers of the enclosing entities.  In this process the following
  2207.    rules must be observed:
  2208.  
  2209.       (1) All of the header fields from the initial enclosing entity
  2210.       (part one), except those that start with "Content-" and the
  2211.       specific header fields "Message-ID", "Encrypted", and "MIME-
  2212.       Version", must be copied, in order, to the new message.
  2213.  
  2214.       (2) Only those header fields in the enclosed message which start
  2215.       with "Content-" and "Message-ID", "Encrypted", and "MIME-Version"
  2216.       must be appended, in order, to the header fields of the new
  2217.       message.  Any header fields in the enclosed message which do not
  2218.       start with "Content-" (except for "Message-ID", "Encrypted", and
  2219.       "MIME-Version") will be ignored.
  2220.  
  2221.       (3) All of the header fields from the second and any subsequent
  2222.       messages will be ignored.
  2223.  
  2224.    For example, if an audio message is broken into two parts, the first
  2225.    part might look something like this:
  2226.  
  2227.       X-Weird-Header-1: Foo
  2228.       From: Bill@host.com
  2229.       To: joe@otherhost.com
  2230.       Subject: Audio mail
  2231.       Message-ID: <id1@host.com>
  2232.       MIME-Version: 1.0
  2233.       Content-type: message/partial;
  2234.            id="ABC@host.com";
  2235.            number=1; total=2
  2236.  
  2237.       X-Weird-Header-1: Bar
  2238.       X-Weird-Header-2: Hello
  2239.  
  2240.  
  2241.  
  2242. Borenstein & Freed                                             [Page 40]
  2243.  
  2244. RFC 1521                          MIME                    September 1993
  2245.  
  2246.  
  2247.       Message-ID: <anotherid@foo.com>
  2248.       MIME-Version: 1.0
  2249.       Content-type: audio/basic
  2250.       Content-transfer-encoding: base64
  2251.  
  2252.          ... first half of encoded audio data goes here...
  2253.  
  2254.    and the second half might look something like this:
  2255.  
  2256.       From: Bill@host.com
  2257.       To: joe@otherhost.com
  2258.       Subject: Audio mail
  2259.       MIME-Version: 1.0
  2260.       Message-ID: <id2@host.com>
  2261.       Content-type: message/partial;
  2262.            id="ABC@host.com"; number=2; total=2
  2263.  
  2264.          ... second half of encoded audio data goes here...
  2265.  
  2266.    Then, when the fragmented message is reassembled, the resulting
  2267.    message to be displayed to the user should look something like this:
  2268.  
  2269.       X-Weird-Header-1: Foo
  2270.       From: Bill@host.com
  2271.       To: joe@otherhost.com
  2272.       Subject: Audio mail
  2273.       Message-ID: <anotherid@foo.com>
  2274.       MIME-Version: 1.0
  2275.       Content-type: audio/basic
  2276.       Content-transfer-encoding: base64
  2277.  
  2278.          ... first half of encoded audio data goes here...
  2279.          ... second half of encoded audio data goes here...
  2280.  
  2281.    Note on encoding of MIME entities encapsulated inside message/partial
  2282.    entities: Because data of type "message" may never be encoded in
  2283.    base64 or quoted-printable, a problem might arise if message/partial
  2284.    entities are constructed in an environment that supports binary or
  2285.    8-bit transport.  The problem is that the binary data would be split
  2286.    into multiple message/partial objects, each of them requiring binary
  2287.    transport.  If such objects were encountered at a gateway into a 7-
  2288.    bit transport environment, there would be no way to properly encode
  2289.    them for the 7-bit world, aside from waiting for all of the parts,
  2290.    reassembling the message, and then encoding the reassembled data in
  2291.    base64 or quoted-printable.  Since it is possible that different
  2292.    parts might go through different gateways, even this is not an
  2293.    acceptable solution.  For this reason, it is specified that MIME
  2294.    entities of type message/partial must always have a content-
  2295.  
  2296.  
  2297.  
  2298. Borenstein & Freed                                             [Page 41]
  2299.  
  2300. RFC 1521                          MIME                    September 1993
  2301.  
  2302.  
  2303.    transfer-encoding of 7-bit (the default).  In particular, even in
  2304.    environments that support binary or 8-bit transport, the use of a
  2305.    content-transfer-encoding of "8bit" or "binary" is explicitly
  2306.    prohibited for entities of type message/partial.
  2307.  
  2308.    It should be noted that, because some message transfer agents may
  2309.    choose to automatically fragment large messages, and because such
  2310.    agents may use different fragmentation thresholds, it is possible
  2311.    that the pieces of a partial message, upon reassembly, may prove
  2312.    themselves to comprise a partial message.  This is explicitly
  2313.    permitted.
  2314.  
  2315.    It should also be noted that the inclusion of a "References" field in
  2316.    the headers of the second and subsequent pieces of a fragmented
  2317.    message that references the Message-Id on the previous piece may be
  2318.    of benefit to mail readers that understand and track references.
  2319.    However, the generation of such "References" fields is entirely
  2320.    optional.
  2321.  
  2322.    Finally, it should be noted that the "Encrypted" header field has
  2323.    been made obsolete by Privacy Enhanced Messaging (PEM), but the rules
  2324.    above are believed to describe the correct way to treat it if it is
  2325.    encountered in the context of conversion to and from message/partial
  2326.    fragments.
  2327.  
  2328. 7.3.3.     The Message/External-Body subtype
  2329.  
  2330.    The external-body subtype indicates that the actual body data are not
  2331.    included, but merely referenced.  In this case, the parameters
  2332.    describe a mechanism for accessing the external data.
  2333.  
  2334.    When an entity is of type "message/external-body", it consists of a
  2335.    header, two consecutive CRLFs, and the message header for the
  2336.    encapsulated message.  If another pair of consecutive CRLFs appears,
  2337.    this of course ends the message header for the encapsulated message.
  2338.    However, since the encapsulated message's body is itself external, it
  2339.    does NOT appear in the area that follows.  For example, consider the
  2340.    following message:
  2341.  
  2342.       Content-type: message/external-body; access-
  2343.       type=local-file;
  2344.  
  2345.            name="/u/nsb/Me.gif"
  2346.  
  2347.       Content-type:  image/gif
  2348.       Content-ID: <id42@guppylake.bellcore.com>
  2349.       Content-Transfer-Encoding: binary
  2350.  
  2351.  
  2352.  
  2353.  
  2354. Borenstein & Freed                                             [Page 42]
  2355.  
  2356. RFC 1521                          MIME                    September 1993
  2357.  
  2358.  
  2359.       THIS IS NOT REALLY THE BODY!
  2360.  
  2361.    The area at the end, which might be called the "phantom body", is
  2362.    ignored for most external-body messages.  However, it may be used to
  2363.    contain auxiliary information for some such messages, as indeed it is
  2364.    when the access-type is "mail-server".  Of the access-types defined
  2365.    by this document, the phantom body is used only when the access-type
  2366.    is "mail-server".  In all other cases, the phantom body is ignored.
  2367.  
  2368.    The only always-mandatory parameter for message/external-body is
  2369.    "access-type"; all of the other parameters may be mandatory or
  2370.    optional depending on the value of access-type.
  2371.  
  2372.       ACCESS-TYPE -- A case-insensitive word, indicating the supported
  2373.       access mechanism by which the file or data may be obtained.
  2374.       Values include, but are not limited to, "FTP", "ANON-FTP", "TFTP",
  2375.       "AFS", "LOCAL-FILE", and "MAIL-SERVER".  Future values, except for
  2376.       experimental values beginning with "X-" must be registered with
  2377.       IANA, as described in Appendix E .
  2378.  
  2379.    In addition, the following three parameters are optional for ALL
  2380.    access-types:
  2381.  
  2382.       EXPIRATION -- The date (in the RFC 822 "date-time" syntax, as
  2383.       extended by RFC 1123 to permit 4 digits in the year field) after
  2384.       which the existence of the external data is not guaranteed.
  2385.  
  2386.       SIZE -- The size (in octets) of the data.  The intent of this
  2387.       parameter is to help the recipient decide whether or not to expend
  2388.       the necessary resources to retrieve the external data.  Note that
  2389.       this describes the size of the data in its canonical form, that
  2390.       is, before any Content- Transfer-Encoding has been applied or
  2391.       after the data have been decoded.
  2392.  
  2393.       PERMISSION -- A case-insensitive field that indicates whether or
  2394.       not it is expected that clients might also attempt to overwrite
  2395.       the data.  By default, or if permission is "read", the assumption
  2396.       is that they are not, and that if the data is retrieved once, it
  2397.       is never needed again.  If PERMISSION is "read-write", this
  2398.       assumption is invalid, and any local copy must be considered no
  2399.       more than a cache.  "Read" and "Read-write" are the only defined
  2400.       values of permission.
  2401.  
  2402.    The precise semantics of the access-types defined here are described
  2403.    in the sections that follow.
  2404.  
  2405.    The encapsulated headers in ALL message/external-body entities MUST
  2406.    include a Content-ID header field to give a unique identifier by
  2407.  
  2408.  
  2409.  
  2410. Borenstein & Freed                                             [Page 43]
  2411.  
  2412. RFC 1521                          MIME                    September 1993
  2413.  
  2414.  
  2415.    which to reference the data.  This identifier may be used for
  2416.    cacheing mechanisms, and for recognizing the receipt of the data when
  2417.    the access-type is "mail-server".
  2418.  
  2419.    Note that, as specified here, the tokens that describe external-body
  2420.    data, such as file names and mail server commands, are required to be
  2421.    in the US-ASCII character set.  If this proves problematic in
  2422.    practice, a new mechanism may be required as a future extension to
  2423.    MIME, either as newly defined access-types for message/external-body
  2424.    or by some other mechanism.
  2425.  
  2426.    As with message/partial, it is specified that MIME entities of type
  2427.    message/external-body must always have a content-transfer-encoding of
  2428.    7-bit (the default).  In particular, even in environments that
  2429.    support binary or 8-bit transport, the use of a content-transfer-
  2430.    encoding of "8bit" or "binary" is explicitly prohibited for entities
  2431.    of type message/external-body.
  2432.  
  2433. 7.3.3.1.  The "ftp" and "tftp" access-types
  2434.  
  2435.    An access-type of FTP or TFTP indicates that the message body is
  2436.    accessible as a file using the FTP [RFC-959] or TFTP [RFC-783]
  2437.    protocols, respectively.  For these access-types, the following
  2438.    additional parameters are mandatory:
  2439.  
  2440.       NAME -- The name of the file that contains the actual body data.
  2441.  
  2442.       SITE -- A machine from which the file may be obtained, using the
  2443.       given protocol. This must be a fully qualified domain name, not a
  2444.       nickname.
  2445.  
  2446.    Before any data are retrieved, using FTP, the user will generally
  2447.    need to be asked to provide a login id and a password for the machine
  2448.    named by the site parameter.  For security reasons, such an id and
  2449.    password are not specified as content-type parameters, but must be
  2450.    obtained from the user.
  2451.  
  2452.    In addition, the following parameters are optional:
  2453.  
  2454.       DIRECTORY -- A directory from which the data named by NAME should
  2455.       be retrieved.
  2456.  
  2457.       MODE -- A case-insensitive string indicating the mode to be used
  2458.       when retrieving the information.  The legal values for access-type
  2459.       "TFTP" are "NETASCII", "OCTET", and "MAIL", as specified by the
  2460.       TFTP protocol [RFC-783].  The legal values for access-type "FTP"
  2461.       are "ASCII", "EBCDIC", "IMAGE", and "LOCALn" where "n" is a
  2462.       decimal integer, typically 8.  These correspond to the
  2463.  
  2464.  
  2465.  
  2466. Borenstein & Freed                                             [Page 44]
  2467.  
  2468. RFC 1521                          MIME                    September 1993
  2469.  
  2470.  
  2471.       representation types "A" "E" "I" and "L n" as specified by the FTP
  2472.       protocol [RFC-959].  Note that "BINARY" and "TENEX" are not valid
  2473.       values for MODE, but that "OCTET" or "IMAGE" or "LOCAL8" should be
  2474.       used instead.  IF MODE is not specified, the default value is
  2475.       "NETASCII" for TFTP and "ASCII" otherwise.
  2476.  
  2477. 7.3.3.2.  The "anon-ftp" access-type
  2478.  
  2479.    The "anon-ftp" access-type is identical to the "ftp" access type,
  2480.    except that the user need not be asked to provide a name and password
  2481.    for the specified site.  Instead, the ftp protocol will be used with
  2482.    login "anonymous" and a password that corresponds to the user's email
  2483.    address.
  2484.  
  2485. 7.3.3.3.  The "local-file" and "afs" access-types
  2486.  
  2487.    An access-type of "local-file" indicates that the actual body is
  2488.    accessible as a file on the local machine.  An access-type of "afs"
  2489.    indicates that the file is accessible via the global AFS file system.
  2490.    In both cases, only a single parameter is required:
  2491.  
  2492.       NAME -- The name of the file that contains the actual body data.
  2493.  
  2494.    The following optional parameter may be used to describe the locality
  2495.    of reference for the data, that is, the site or sites at which the
  2496.    file is expected to be visible:
  2497.  
  2498.       SITE -- A domain specifier for a machine or set of machines that
  2499.       are known to have access to the data file.  Asterisks may be used
  2500.       for wildcard matching to a part of a domain name, such as
  2501.       "*.bellcore.com", to indicate a set of machines on which the data
  2502.       should be directly visible, while a single asterisk may be used to
  2503.       indicate a file that is expected to be universally available,
  2504.       e.g., via a global file system.
  2505.  
  2506. 7.3.3.4.  The "mail-server" access-type
  2507.  
  2508.    The "mail-server" access-type indicates that the actual body is
  2509.    available from a mail server.  The mandatory parameter for this
  2510.    access-type is:
  2511.  
  2512.       SERVER -- The email address of the mail server from which the
  2513.       actual body data can be obtained.
  2514.  
  2515.    Because mail servers accept a variety of syntaxes, some of which is
  2516.    multiline, the full command to be sent to a mail server is not
  2517.    included as a parameter on the content-type line.  Instead, it is
  2518.    provided as the "phantom body" when the content-type is
  2519.  
  2520.  
  2521.  
  2522. Borenstein & Freed                                             [Page 45]
  2523.  
  2524. RFC 1521                          MIME                    September 1993
  2525.  
  2526.  
  2527.    message/external-body and the access- type is mail-server.
  2528.  
  2529.    An optional parameter for this access-type is:
  2530.  
  2531.       SUBJECT -- The subject that is to be used in the mail that is sent
  2532.       to obtain the data. Note that keying mail servers on Subject lines
  2533.       is NOT recommended, but such mail servers are known to exist.
  2534.  
  2535.    Note that MIME does not define a mail server syntax.  Rather, it
  2536.    allows the inclusion of arbitrary mail server commands in the phantom
  2537.    body.  Implementations must include the phantom body in the body of
  2538.    the message it sends to the mail server address to retrieve the
  2539.    relevant data.
  2540.  
  2541.    It is worth noting that, unlike other access-types, mail-server
  2542.    access is asynchronous and will happen at an unpredictable time in
  2543.    the future.  For this reason, it is important that there be a
  2544.    mechanism by which the returned data can be matched up with the
  2545.    original message/external-body entity.  MIME mailservers must use the
  2546.    same Content-ID field on the returned message that was used in the
  2547.    original message/external-body entity, to facilitate such matching.
  2548.  
  2549. 7.3.3.5.  Examples and Further Explanations
  2550.  
  2551.    With the emerging possibility of very wide-area file systems, it
  2552.    becomes very hard to know in advance the set of machines where a file
  2553.    will and will not be accessible directly from the file system.
  2554.    Therefore it may make sense to provide both a file name, to be tried
  2555.    directly, and the name of one or more sites from which the file is
  2556.    known to be accessible.  An implementation can try to retrieve remote
  2557.    files using FTP or any other protocol, using anonymous file retrieval
  2558.    or prompting the user for the necessary name and password.  If an
  2559.    external body is accessible via multiple mechanisms, the sender may
  2560.    include multiple parts of type message/external-body within an entity
  2561.    of type multipart/alternative.
  2562.  
  2563.    However, the external-body mechanism is not intended to be limited to
  2564.    file retrieval, as shown by the mail-server access-type.  Beyond
  2565.    this, one can imagine, for example, using a video server for external
  2566.    references to video clips.
  2567.  
  2568.    If an entity is of type "message/external-body", then the body of the
  2569.    entity will contain the header fields of the encapsulated message.
  2570.    The body itself is to be found in the external location.  This means
  2571.    that if the body of the "message/external-body" message contains two
  2572.    consecutive CRLFs, everything after those pairs is NOT part of the
  2573.    message itself.  For most message/external-body messages, this
  2574.    trailing area must simply be ignored.  However, it is a convenient
  2575.  
  2576.  
  2577.  
  2578. Borenstein & Freed                                             [Page 46]
  2579.  
  2580. RFC 1521                          MIME                    September 1993
  2581.  
  2582.  
  2583.    place for additional data that cannot be included in the content-type
  2584.    header field.  In particular, if the "access-type" value is "mail-
  2585.    server", then the trailing area must contain commands to be sent to
  2586.    the mail server at the address given by the value of the SERVER
  2587.    parameter.
  2588.  
  2589.    The embedded message header fields which appear in the body of the
  2590.    message/external-body data must be used to declare the Content-type
  2591.    of the external body if it is anything other than plain ASCII text,
  2592.    since the external body does not have a header section to declare its
  2593.    type.  Similarly, any Content-transfer-encoding other than "7bit"
  2594.    must also be declared here.  Thus a complete message/external-body
  2595.    message, referring to a document in PostScript format, might look
  2596.    like this:
  2597.  
  2598.       From: Whomever
  2599.       To: Someone
  2600.       Subject: whatever
  2601.       MIME-Version: 1.0
  2602.       Message-ID: <id1@host.com>
  2603.       Content-Type: multipart/alternative; boundary=42
  2604.       Content-ID: <id001@guppylake.bellcore.com>
  2605.  
  2606.       --42
  2607.       Content-Type: message/external-body;
  2608.            name="BodyFormats.ps";
  2609.            site="thumper.bellcore.com";
  2610.            access-type=ANON-FTP;
  2611.            directory="pub";
  2612.            mode="image";
  2613.            expiration="Fri, 14 Jun 1991 19:13:14 -0400 (EDT)"
  2614.  
  2615.       Content-type: application/postscript
  2616.       Content-ID: <id42@guppylake.bellcore.com>
  2617.  
  2618.       --42
  2619.       Content-Type: message/external-body;
  2620.            name="/u/nsb/writing/rfcs/RFC-MIME.ps";
  2621.            site="thumper.bellcore.com";
  2622.            access-type=AFS
  2623.            expiration="Fri, 14 Jun 1991 19:13:14 -0400 (EDT)"
  2624.  
  2625.       Content-type: application/postscript
  2626.       Content-ID: <id42@guppylake.bellcore.com>
  2627.  
  2628.       --42
  2629.       Content-Type: message/external-body;
  2630.            access-type=mail-server
  2631.  
  2632.  
  2633.  
  2634. Borenstein & Freed                                             [Page 47]
  2635.  
  2636. RFC 1521                          MIME                    September 1993
  2637.  
  2638.  
  2639.            server="listserv@bogus.bitnet";
  2640.            expiration="Fri, 14 Jun 1991 19:13:14 -0400 (EDT)"
  2641.  
  2642.       Content-type: application/postscript
  2643.       Content-ID: <id42@guppylake.bellcore.com>
  2644.  
  2645.       get RFC-MIME.DOC
  2646.  
  2647.       --42--
  2648.  
  2649.    Note that in the above examples, the default Content-transfer-
  2650.    encoding of "7bit" is assumed for the external postscript data.
  2651.  
  2652.    Like the message/partial type, the message/external-body type is
  2653.    intended to be transparent, that is, to convey the data type in the
  2654.    external body rather than to convey a message with a body of that
  2655.    type.  Thus the headers on the outer and inner parts must be merged
  2656.    using the same rules as for message/partial.  In particular, this
  2657.    means that the Content-type header is overridden, but the From and
  2658.    Subject headers are preserved.
  2659.  
  2660.    Note that since the external bodies are not transported as mail, they
  2661.    need not conform to the 7-bit and line length requirements, but might
  2662.    in fact be binary files.  Thus a Content-Transfer-Encoding is not
  2663.    generally necessary, though it is permitted.
  2664.  
  2665.    Note that the body of a message of type "message/external-body" is
  2666.    governed by the basic syntax for an RFC 822 message.  In particular,
  2667.    anything before the first consecutive pair of CRLFs is header
  2668.    information, while anything after it is body information, which is
  2669.    ignored for most access-types.
  2670.  
  2671.    The formal grammar for content-type header fields for data of type
  2672.    message is given by:
  2673.  
  2674.    message-type := "message" "/" message-subtype
  2675.  
  2676.    message-subtype := "rfc822"
  2677.                    / "partial" 2#3partial-param
  2678.                    / "external-body" 1*external-param
  2679.                    / extension-token
  2680.  
  2681.    partial-param :=     (";" "id" "=" value)
  2682.               /  (";" "number" "=" 1*DIGIT)
  2683.               /  (";" "total" "=" 1*DIGIT)
  2684.          ; id & number required; total  required  for  last part
  2685.  
  2686.    external-param :=   (";" "access-type" "=" atype)
  2687.  
  2688.  
  2689.  
  2690. Borenstein & Freed                                             [Page 48]
  2691.  
  2692. RFC 1521                          MIME                    September 1993
  2693.  
  2694.  
  2695.               / (";" "expiration" "=" date-time)
  2696.                    ; Note that date-time is quoted
  2697.               / (";" "size" "=" 1*DIGIT)
  2698.               / (";"  "permission"  "="  ("read"  /  "read-write"))
  2699.                    ; Permission is case-insensitive
  2700.               / (";" "name" "="  value)
  2701.               / (";" "site" "=" value)
  2702.               / (";" "dir" "=" value)
  2703.               / (";" "mode" "=" value)
  2704.               / (";" "server" "=" value)
  2705.               / (";" "subject" "=" value)
  2706.           ; access-type required;others required based on access-type
  2707.  
  2708.    atype := "ftp" / "anon-ftp" / "tftp" / "local-file"
  2709.                   / "afs" / "mail-server" / extension-token
  2710.                   ; Case-insensitive
  2711.  
  2712. 7.4.  The Application Content-Type
  2713.  
  2714.    The "application" Content-Type is to be used for data which do not
  2715.    fit in any of the other categories, and particularly for data to be
  2716.    processed by mail-based uses of application programs.  This is
  2717.    information which must be processed by an application before it is
  2718.    viewable or usable to a user.  Expected uses for Content-Type
  2719.    application include mail-based file transfer, spreadsheets, data for
  2720.    mail-based scheduling systems, and languages for "active"
  2721.    (computational) email.  (The latter, in particular, can pose security
  2722.    problems which must be understood by implementors, and are considered
  2723.    in detail in the discussion of the application/PostScript content-
  2724.    type.)
  2725.  
  2726.    For example, a meeting scheduler might define a standard
  2727.    representation for information about proposed meeting dates.  An
  2728.    intelligent user agent would use this information to conduct a dialog
  2729.    with the user, and might then send further mail based on that dialog.
  2730.    More generally, there have been several "active" messaging languages
  2731.    developed in which programs in a suitably specialized language are
  2732.    sent through the mail and automatically run in the recipient's
  2733.    environment.
  2734.  
  2735.    Such applications may be defined as subtypes of the "application"
  2736.    Content-Type.  This document defines two subtypes: octet-stream, and
  2737.    PostScript.
  2738.  
  2739.    In general, the subtype of application will often be the name of the
  2740.    application for which the data are intended.  This does not mean,
  2741.    however, that any application program name may be used freely as a
  2742.    subtype of application.  Such usages (other than subtypes beginning
  2743.  
  2744.  
  2745.  
  2746. Borenstein & Freed                                             [Page 49]
  2747.  
  2748. RFC 1521                          MIME                    September 1993
  2749.  
  2750.  
  2751.    with "x-") must be registered with IANA, as described in Appendix E.
  2752.  
  2753. 7.4.1.     The Application/Octet-Stream (primary) subtype
  2754.  
  2755.    The primary subtype of application, "octet-stream", may be used to
  2756.    indicate that a body contains binary data.  The set of possible
  2757.    parameters includes, but is not limited to:
  2758.  
  2759.       TYPE -- the general type or category of binary data.  This is
  2760.       intended as information for the human recipient rather than for
  2761.       any automatic processing.
  2762.  
  2763.       PADDING -- the number of bits of padding that were appended to the
  2764.       bit-stream comprising the actual contents to produce the enclosed
  2765.       byte-oriented data.  This is useful for enclosing a bit-stream in
  2766.       a body when the total number of bits is not a multiple of the byte
  2767.       size.
  2768.  
  2769.    An additional parameter, "conversions", was defined in [RFC-1341] but
  2770.    has been removed.
  2771.  
  2772.    RFC 1341 also defined the use of a "NAME" parameter which gave a
  2773.    suggested file name to be used if the data were to be written to a
  2774.    file.  This has been deprecated in anticipation of a separate
  2775.    Content-Disposition header field, to be defined in a subsequent RFC.
  2776.  
  2777.    The recommended action for an implementation that receives
  2778.    application/octet-stream mail is to simply offer to put the data in a
  2779.    file, with any Content-Transfer-Encoding undone, or perhaps to use it
  2780.    as input to a user-specified process.
  2781.  
  2782.    To reduce the danger of transmitting rogue programs through the mail,
  2783.    it is strongly recommended that implementations NOT implement a
  2784.    path-search mechanism whereby an arbitrary program named in the
  2785.    Content-Type parameter (e.g., an "interpreter=" parameter) is found
  2786.    and executed using the mail body as input.
  2787.  
  2788. 7.4.2.     The Application/PostScript subtype
  2789.  
  2790.    A Content-Type of "application/postscript" indicates a PostScript
  2791.    program.  Currently two variants of the PostScript language are
  2792.    allowed; the original level 1 variant is described in [POSTSCRIPT]
  2793.    and the more recent level 2 variant is described in [POSTSCRIPT2].
  2794.  
  2795.    PostScript is a registered trademark of Adobe Systems, Inc.  Use of
  2796.    the MIME content-type "application/postscript" implies recognition of
  2797.    that trademark and all the rights it entails.
  2798.  
  2799.  
  2800.  
  2801.  
  2802. Borenstein & Freed                                             [Page 50]
  2803.  
  2804. RFC 1521                          MIME                    September 1993
  2805.  
  2806.  
  2807.    The PostScript language definition provides facilities for internal
  2808.    labeling of the specific language features a given program uses. This
  2809.    labeling, called the PostScript document structuring conventions, is
  2810.    very general and provides substantially more information than just
  2811.    the language level.
  2812.  
  2813.    The use of document structuring conventions, while not required, is
  2814.    strongly recommended as an aid to interoperability.  Documents which
  2815.    lack proper structuring conventions cannot be tested to see whether
  2816.    or not they will work in a given environment.  As such, some systems
  2817.    may assume the worst and refuse to process unstructured documents.
  2818.  
  2819.    The execution of general-purpose PostScript interpreters entails
  2820.    serious security risks, and implementors are discouraged from simply
  2821.    sending PostScript email bodies to "off-the-shelf" interpreters.
  2822.    While it is usually safe to send PostScript to a printer, where the
  2823.    potential for harm is greatly constrained, implementors should
  2824.    consider all of the following before they add interactive display of
  2825.    PostScript bodies to their mail readers.
  2826.  
  2827.    The remainder of this section outlines some, though probably not all,
  2828.    of the possible problems with sending PostScript through the mail.
  2829.  
  2830.    Dangerous operations in the PostScript language include, but may not
  2831.    be limited to, the PostScript operators deletefile, renamefile,
  2832.    filenameforall, and file.  File is only dangerous when applied to
  2833.    something other than standard input or output. Implementations may
  2834.    also define additional nonstandard file operators; these may also
  2835.    pose a threat to security.  Filenameforall, the wildcard file search
  2836.    operator, may appear at first glance to be harmless. Note, however,
  2837.    that this operator has the potential to reveal information about what
  2838.    files the recipient has access to, and this information may itself be
  2839.    sensitive.  Message senders should avoid the use of potentially
  2840.    dangerous file operators, since these operators are quite likely to
  2841.    be unavailable in secure PostScript implementations.  Message-
  2842.    receiving and -displaying software should either completely disable
  2843.    all potentially dangerous file operators or take special care not to
  2844.    delegate any special authority to their operation. These operators
  2845.    should be viewed as being done by an outside agency when interpreting
  2846.    PostScript documents.  Such disabling and/or checking should be done
  2847.    completely outside of the reach of the PostScript language itself;
  2848.    care should be taken to insure that no method exists for re-enabling
  2849.    full-function versions of these operators.
  2850.  
  2851.    The PostScript language provides facilities for exiting the normal
  2852.    interpreter, or server, loop. Changes made in this "outer"
  2853.    environment are customarily retained across documents, and may in
  2854.    some cases be retained semipermanently in nonvolatile memory. The
  2855.  
  2856.  
  2857.  
  2858. Borenstein & Freed                                             [Page 51]
  2859.  
  2860. RFC 1521                          MIME                    September 1993
  2861.  
  2862.  
  2863.    operators associated with exiting the interpreter loop have the
  2864.    potential to interfere with subsequent document processing. As such,
  2865.    their unrestrained use constitutes a threat of service denial.
  2866.    PostScript operators that exit the interpreter loop include, but may
  2867.    not be limited to, the exitserver and startjob operators.  Message-
  2868.    sending software should not generate PostScript that depends on
  2869.    exiting the interpreter loop to operate. The ability to exit will
  2870.    probably be unavailable in secure PostScript implementations.
  2871.    Message-receiving and -displaying software should, if possible,
  2872.    disable the ability to make retained changes to the PostScript
  2873.    environment, and eliminate the startjob and exitserver commands.  If
  2874.    these commands cannot be eliminated, the password associated with
  2875.    them should at least be set to a hard-to-guess value.
  2876.  
  2877.    PostScript provides operators for setting system-wide and device-
  2878.    specific parameters. These parameter settings may be retained across
  2879.    jobs and may potentially pose a threat to the correct operation of
  2880.    the interpreter.  The PostScript operators that set system and device
  2881.    parameters include, but may not be limited to, the setsystemparams
  2882.    and setdevparams operators.  Message-sending software should not
  2883.    generate PostScript that depends on the setting of system or device
  2884.    parameters to operate correctly. The ability to set these parameters
  2885.    will probably be unavailable in secure PostScript implementations.
  2886.    Message-receiving and -displaying software should, if possible,
  2887.    disable the ability to change system and device parameters.  If these
  2888.    operators cannot be disabled, the password associated with them
  2889.    should at least be set to a hard-to-guess value.
  2890.  
  2891.    Some PostScript implementations provide nonstandard facilities for
  2892.    the direct loading and execution of machine code.  Such facilities
  2893.    are quite obviously open to substantial abuse.  Message-sending
  2894.    software should not make use of such features. Besides being totally
  2895.    hardware- specific, they are also likely to be unavailable in secure
  2896.    implementations of PostScript.  Message-receiving and -displaying
  2897.    software should not allow such operators to be used if they exist.
  2898.  
  2899.    PostScript is an extensible language, and many, if not most,
  2900.    implementations of it provide a number of their own extensions. This
  2901.    document does not deal with such extensions explicitly since they
  2902.    constitute an unknown factor.  Message-sending software should not
  2903.    make use of nonstandard extensions; they are likely to be missing
  2904.    from some implementations. Message-receiving and -displaying software
  2905.    should make sure that any nonstandard PostScript operators are secure
  2906.    and don't present any kind of threat.
  2907.  
  2908.    It is possible to write PostScript that consumes huge amounts of
  2909.    various system resources. It is also possible to write PostScript
  2910.    programs that loop infinitely.  Both types of programs have the
  2911.  
  2912.  
  2913.  
  2914. Borenstein & Freed                                             [Page 52]
  2915.  
  2916. RFC 1521                          MIME                    September 1993
  2917.  
  2918.  
  2919.    potential to cause damage if sent to unsuspecting recipients.
  2920.    Message-sending software should avoid the construction and
  2921.    dissemination of such programs, which is antisocial.  Message-
  2922.    receiving and -displaying software should provide appropriate
  2923.    mechanisms to abort processing of a document after a reasonable
  2924.    amount of time has elapsed. In addition, PostScript interpreters
  2925.    should be limited to the consumption of only a reasonable amount of
  2926.    any given system resource.
  2927.  
  2928.    Finally, bugs may exist in some PostScript interpreters which could
  2929.    possibly be exploited to gain unauthorized access to a recipient's
  2930.    system.  Apart from noting this possibility, there is no specific
  2931.    action to take to prevent this, apart from the timely correction of
  2932.    such bugs if any are found.
  2933.  
  2934. 7.4.3.     Other Application subtypes
  2935.  
  2936.    It is expected that many other subtypes of application will be
  2937.    defined in the future.  MIME implementations must generally treat any
  2938.    unrecognized subtypes as being equivalent to application/octet-
  2939.    stream.
  2940.  
  2941.    The formal grammar for content-type header fields for application
  2942.    data is given by:
  2943.  
  2944.    application-type :=  "application" "/" application-subtype
  2945.  
  2946.    application-subtype := ("octet-stream" *stream-param)
  2947.                        / "postscript" / extension-token
  2948.  
  2949.    stream-param :=  (";" "type" "=" value)
  2950.                        / (";" "padding" "=" padding)
  2951.  
  2952.    padding := "0" / "1" /  "2" /  "3" / "4" / "5" / "6" / "7"
  2953.  
  2954. 7.5.  The Image Content-Type
  2955.  
  2956.    A Content-Type of "image" indicates that the body contains an image.
  2957.    The subtype names the specific image format.  These names are case
  2958.    insensitive.  Two initial subtypes are "jpeg" for the JPEG format,
  2959.    JFIF encoding, and "gif" for GIF format [GIF].
  2960.  
  2961.    The list of image subtypes given here is neither exclusive nor
  2962.    exhaustive, and is expected to grow as more types are registered with
  2963.    IANA, as described in Appendix E.
  2964.  
  2965.    The formal grammar for the content-type header field for data of type
  2966.    image is given by:
  2967.  
  2968.  
  2969.  
  2970. Borenstein & Freed                                             [Page 53]
  2971.  
  2972. RFC 1521                          MIME                    September 1993
  2973.  
  2974.  
  2975.    image-type := "image" "/" ("gif" / "jpeg" / extension-token)
  2976.  
  2977. 7.6.  The Audio Content-Type
  2978.  
  2979.    A Content-Type of "audio" indicates that the body contains audio
  2980.    data.  Although there is not yet a consensus on an "ideal" audio
  2981.    format for use with computers, there is a pressing need for a format
  2982.    capable of providing interoperable behavior.
  2983.  
  2984.    The initial subtype of "basic" is specified to meet this requirement
  2985.    by providing an absolutely minimal lowest common denominator audio
  2986.    format.  It is expected that richer formats for higher quality and/or
  2987.    lower bandwidth audio will be defined by a later document.
  2988.  
  2989.    The content of the "audio/basic" subtype is audio encoded using 8-bit
  2990.    ISDN mu-law [PCM].  When this subtype is present, a sample rate of
  2991.    8000 Hz and a single channel is assumed.
  2992.  
  2993.    The formal grammar for the content-type header field for data of type
  2994.    audio is given by:
  2995.  
  2996.    audio-type := "audio" "/" ("basic" / extension-token)
  2997.  
  2998. 7.7.  The Video Content-Type
  2999.  
  3000.    A Content-Type of "video" indicates that the body contains a time-
  3001.    varying-picture image, possibly with color and coordinated sound.
  3002.    The term "video" is used extremely generically, rather than with
  3003.    reference to any particular technology or format, and is not meant to
  3004.    preclude subtypes such as animated drawings encoded compactly.  The
  3005.    subtype "mpeg" refers to video coded according to the MPEG standard
  3006.    [MPEG].
  3007.  
  3008.    Note that although in general this document strongly discourages the
  3009.    mixing of multiple media in a single body, it is recognized that many
  3010.    so-called "video" formats include a representation for synchronized
  3011.    audio, and this is explicitly permitted for subtypes of "video".
  3012.  
  3013.    The formal grammar for the content-type header field for data of type
  3014.    video is given by:
  3015.  
  3016.    video-type := "video" "/" ("mpeg" / extension-token)
  3017.  
  3018. 7.8.  Experimental Content-Type Values
  3019.  
  3020.    A Content-Type value beginning with the characters "X-" is a private
  3021.    value, to be used by consenting mail systems by mutual agreement.
  3022.    Any format without a rigorous and public definition must be named
  3023.  
  3024.  
  3025.  
  3026. Borenstein & Freed                                             [Page 54]
  3027.  
  3028. RFC 1521                          MIME                    September 1993
  3029.  
  3030.  
  3031.    with an "X-" prefix, and publicly specified values shall never begin
  3032.    with "X-".  (Older versions of the widely-used Andrew system use the
  3033.    "X-BE2" name, so new systems should probably choose a different
  3034.    name.)
  3035.  
  3036.    In general, the use of "X-" top-level types is strongly discouraged.
  3037.    Implementors should invent subtypes of the existing types whenever
  3038.    possible.  The invention of new types is intended to be restricted
  3039.    primarily to the development of new media types for email, such as
  3040.    digital odors or holography, and not for new data formats in general.
  3041.    In many cases, a subtype of application will be more appropriate than
  3042.    a new top-level type.
  3043.  
  3044.  
  3045.  
  3046.  
  3047.  
  3048.  
  3049.  
  3050.  
  3051.  
  3052.  
  3053.  
  3054.  
  3055.  
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061.  
  3062.  
  3063.  
  3064.  
  3065.  
  3066.  
  3067.  
  3068.  
  3069.  
  3070.  
  3071.  
  3072.  
  3073.  
  3074.  
  3075.  
  3076.  
  3077.  
  3078.  
  3079.  
  3080.  
  3081.  
  3082. Borenstein & Freed                                             [Page 55]
  3083.  
  3084. RFC 1521                          MIME                    September 1993
  3085.  
  3086.  
  3087. 8. Summary
  3088.  
  3089.    Using the MIME-Version, Content-Type, and Content-Transfer-Encoding
  3090.    header fields, it is possible to include, in a standardized way,
  3091.    arbitrary types of data objects with RFC 822 conformant mail
  3092.    messages.  No restrictions imposed by either RFC 821 or RFC 822 are
  3093.    violated, and care has been taken to avoid problems caused by
  3094.    additional restrictions imposed by the characteristics of some
  3095.    Internet mail transport mechanisms (see Appendix B). The "multipart"
  3096.    and "message" Content-Types allow mixing and hierarchical structuring
  3097.    of objects of different types in a single message.  Further Content-
  3098.    Types provide a standardized mechanism for tagging messages or body
  3099.    parts as audio, image, or several other kinds of data.  A
  3100.    distinguished parameter syntax allows further specification of data
  3101.    format details, particularly the specification of alternate character
  3102.    sets.  Additional optional header fields provide mechanisms for
  3103.    certain extensions deemed desirable by many implementors.  Finally, a
  3104.    number of useful Content-Types are defined for general use by
  3105.    consenting user agents, notably message/partial, and
  3106.    message/external-body.
  3107.  
  3108. 9. Security Considerations
  3109.  
  3110.    Security issues are discussed in Section 7.4.2 and in Appendix F.
  3111.    Implementors should pay special attention to the security
  3112.    implications of any mail content-types that can cause the remote
  3113.    execution of any actions in the recipient's environment.  In such
  3114.    cases, the discussion of the application/postscript content-type in
  3115.    Section 7.4.2 may serve as a model for considering other content-
  3116.    types with remote execution capabilities.
  3117.  
  3118.  
  3119.  
  3120.  
  3121.  
  3122.  
  3123.  
  3124.  
  3125.  
  3126.  
  3127.  
  3128.  
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138. Borenstein & Freed                                             [Page 56]
  3139.  
  3140. RFC 1521                          MIME                    September 1993
  3141.  
  3142.  
  3143. 10. Authors' Addresses
  3144.  
  3145.    For more information, the authors of this document may be contacted
  3146.    via Internet mail:
  3147.  
  3148.    Nathaniel S. Borenstein
  3149.    MRE 2D-296, Bellcore
  3150.    445 South St.
  3151.    Morristown, NJ 07962-1910
  3152.  
  3153.    Phone: +1 201 829 4270
  3154.    Fax:  +1 201 829 7019
  3155.    Email: nsb@bellcore.com
  3156.  
  3157.  
  3158.    Ned Freed
  3159.    Innosoft International, Inc.
  3160.    250 West First Street
  3161.    Suite 240
  3162.    Claremont, CA 91711
  3163.  
  3164.    Phone:  +1 909 624 7907
  3165.    Fax: +1 909 621 5319
  3166.    Email: ned@innosoft.com
  3167.  
  3168.    MIME is a result of the work of the Internet Engineering Task Force
  3169.    Working Group on Email Extensions. The chairman of that group, Greg
  3170.    Vaudreuil, may be reached at:
  3171.  
  3172.    Gregory M. Vaudreuil
  3173.    Tigon Corporation
  3174.    17060 Dallas Parkway
  3175.    Dallas Texas, 75248
  3176.  
  3177.    Phone:    +1 214-733-2722
  3178.    EMail: gvaudre@cnri.reston.va.us
  3179.  
  3180.  
  3181.  
  3182.  
  3183.  
  3184.  
  3185.  
  3186.  
  3187.  
  3188.  
  3189.  
  3190.  
  3191.  
  3192.  
  3193.  
  3194. Borenstein & Freed                                             [Page 57]
  3195.  
  3196. RFC 1521                          MIME                    September 1993
  3197.  
  3198.  
  3199. 11. Acknowledgements
  3200.  
  3201.    This document is the result of the collective effort of a large
  3202.    number of people, at several IETF meetings, on the IETF-SMTP and
  3203.    IETF-822 mailing lists, and elsewhere.  Although any enumeration
  3204.    seems doomed to suffer from egregious omissions, the following are
  3205.    among the many contributors to this effort:
  3206.  
  3207.             Harald Tveit Alvestrand       Timo Lehtinen
  3208.             Randall Atkinson              John R. MacMillan
  3209.             Philippe Brandon              Rick McGowan
  3210.             Kevin Carosso                 Leo Mclaughlin
  3211.             Uhhyung Choi                  Goli Montaser-Kohsari
  3212.             Cristian Constantinof         Keith Moore
  3213.             Mark Crispin                  Tom Moore
  3214.             Dave Crocker                  Erik Naggum
  3215.             Terry Crowley                 Mark Needleman
  3216.             Walt Daniels                  John Noerenberg
  3217.             Frank Dawson                  Mats Ohrman
  3218.             Hitoshi Doi                   Julian Onions
  3219.             Kevin Donnelly                Michael Patton
  3220.             Keith Edwards                 David J. Pepper
  3221.             Chris Eich                    Blake C. Ramsdell
  3222.             Johnny Eriksson               Luc Rooijakkers
  3223.             Craig Everhart                Marshall T. Rose
  3224.             Patrik Faeltstroem            Jonathan Rosenberg
  3225.             Erik E. Fair                  Jan Rynning
  3226.             Roger Fajman                  Harri Salminen
  3227.             Alain Fontaine                Michael Sanderson
  3228.             James M. Galvin               Masahiro Sekiguchi
  3229.             Philip Gladstone              Mark Sherman
  3230.             Thomas Gordon                 Keld Simonsen
  3231.             Phill Gross                   Bob Smart
  3232.             James Hamilton                Peter Speck
  3233.             Steve Hardcastle-Kille        Henry Spencer
  3234.             David Herron                  Einar Stefferud
  3235.             Bruce Howard                  Michael Stein
  3236.             Bill Janssen                  Klaus Steinberger
  3237.             Olle Jaernefors               Peter Svanberg
  3238.             Risto Kankkunen               James Thompson
  3239.             Phil Karn                     Steve Uhler
  3240.             Alan Katz                     Stuart Vance
  3241.             Tim Kehres                    Erik van der Poel
  3242.             Neil Katin                    Guido van Rossum
  3243.             Kyuho Kim                     Peter Vanderbilt
  3244.             Anders Klemets                Greg Vaudreuil
  3245.             John Klensin                  Ed Vielmetti
  3246.             Valdis Kletniek               Ryan Waldron
  3247.  
  3248.  
  3249.  
  3250. Borenstein & Freed                                             [Page 58]
  3251.  
  3252. RFC 1521                          MIME                    September 1993
  3253.  
  3254.  
  3255.             Jim Knowles                   Wally Wedel
  3256.             Stev Knowles                  Sven-Ove Westberg
  3257.             Bob Kummerfeld                Brian Wideen
  3258.             Pekka Kytolaakso              John Wobus
  3259.             Stellan Lagerstrom            Glenn Wright
  3260.             Vincent Lau                   Rayan Zachariassen
  3261.             Donald Lindsay                David Zimmerman
  3262.             Marc Andreessen               Bob Braden
  3263.             Brian Capouch                 Peter Clitherow
  3264.             Dave Collier-Brown            John Coonrod
  3265.             Stephen Crocker               Jim Davis
  3266.             Axel Deininger                Dana S Emery
  3267.             Martin Forssen                Stephen Gildea
  3268.             Terry Gray                    Mark Horton
  3269.             Warner Losh                   Carlyn Lowery
  3270.             Laurence Lundblade            Charles Lynn
  3271.             Larry Masinter                Michael J. McInerny
  3272.             Jon Postel                    Christer Romson
  3273.             Yutaka Sato                   Markku Savela
  3274.             Richard Alan Schafer          Larry W. Virden
  3275.             Rhys Weatherly                Jay Weber
  3276.             Dave Wecker
  3277.  
  3278. The authors apologize for any omissions from this list, which are
  3279. certainly unintentional.
  3280.  
  3281.  
  3282.  
  3283.  
  3284.  
  3285.  
  3286.  
  3287.  
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  
  3306. Borenstein & Freed                                             [Page 59]
  3307.  
  3308. RFC 1521                          MIME                    September 1993
  3309.  
  3310.  
  3311. Appendix A -- Minimal MIME-Conformance
  3312.  
  3313.    The mechanisms described in this document are open-ended.  It is
  3314.    definitely not expected that all implementations will support all of
  3315.    the Content-Types described, nor that they will all share the same
  3316.    extensions.  In order to promote interoperability, however, it is
  3317.    useful to define the concept of "MIME-conformance" to define a
  3318.    certain level of implementation that allows the useful interworking
  3319.    of messages with content that differs from US ASCII text.  In this
  3320.    section, we specify the requirements for such conformance.
  3321.  
  3322.    A mail user agent that is MIME-conformant MUST:
  3323.  
  3324.       1.  Always generate a "MIME-Version: 1.0" header field.
  3325.  
  3326.       2.  Recognize the Content-Transfer-Encoding header field, and
  3327.       decode all received data encoded with either the quoted-printable
  3328.       or base64 implementations.  Encode any data sent that is not in
  3329.       seven-bit mail-ready representation using one of these
  3330.       transformations and include the appropriate Content-Transfer-
  3331.       Encoding header field, unless the underlying transport mechanism
  3332.       supports non-seven-bit data, as SMTP does not.
  3333.  
  3334.       3.  Recognize and interpret the Content-Type header field, and
  3335.       avoid showing users raw data with a Content-Type field other than
  3336.       text.  Be able to send at least text/plain messages, with the
  3337.       character set specified as a parameter if it is not US-ASCII.
  3338.  
  3339.       4.  Explicitly handle the following Content-Type values, to at
  3340.       least the following extents:
  3341.  
  3342.       Text:
  3343.  
  3344.             -- Recognize and display "text" mail
  3345.                  with the character set "US-ASCII."
  3346.  
  3347.             -- Recognize other character sets at
  3348.                  least to the extent of being able
  3349.                  to inform the user about what
  3350.                  character set the message uses.
  3351.  
  3352.             -- Recognize the "ISO-8859-*" character
  3353.                  sets to the extent of being able to
  3354.                  display those characters that are
  3355.                  common to ISO-8859-* and US-ASCII,
  3356.                  namely all characters represented
  3357.                  by octet values 0-127.
  3358.  
  3359.  
  3360.  
  3361.  
  3362. Borenstein & Freed                                             [Page 60]
  3363.  
  3364. RFC 1521                          MIME                    September 1993
  3365.  
  3366.  
  3367.             -- For unrecognized subtypes, show or
  3368.                  offer to show the user the "raw"
  3369.                  version of the data after
  3370.                  conversion of the content from
  3371.                  canonical form to local form.
  3372.  
  3373.        Message:
  3374.  
  3375.             -- Recognize and display at least the
  3376.                  primary (822) encapsulation.
  3377.  
  3378.        Multipart:
  3379.  
  3380.             -- Recognize the primary (mixed)
  3381.                  subtype.  Display all relevant
  3382.                  information on the message level
  3383.                  and the body part header level and
  3384.                  then display or offer to display
  3385.                  each of the body parts individually.
  3386.  
  3387.             -- Recognize the "alternative" subtype,
  3388.                  and avoid showing the user
  3389.                  redundant parts of
  3390.                  multipart/alternative mail.
  3391.  
  3392.             -- Treat any unrecognized subtypes as if
  3393.                  they were "mixed".
  3394.  
  3395.        Application:
  3396.  
  3397.             -- Offer the ability to remove either of
  3398.                  the two types of Content-Transfer-
  3399.                  Encoding defined in this document
  3400.                  and put the resulting information
  3401.                  in a user file.
  3402.  
  3403.       5.  Upon encountering any unrecognized Content- Type, an
  3404.       implementation must treat it as if it had a Content-Type of
  3405.       "application/octet-stream" with no parameter sub-arguments.  How
  3406.       such data are handled is up to an implementation, but likely
  3407.       options for handling such unrecognized data include offering the
  3408.       user to write it into a file (decoded from its mail transport
  3409.       format) or offering the user to name a program to which the
  3410.       decoded data should be passed as input.  Unrecognized predefined
  3411.       types, which in a MIME-conformant mailer might still include
  3412.       audio, image, or video, should also be treated in this way.
  3413.  
  3414.    A user agent that meets the above conditions is said to be MIME-
  3415.  
  3416.  
  3417.  
  3418. Borenstein & Freed                                             [Page 61]
  3419.  
  3420. RFC 1521                          MIME                    September 1993
  3421.  
  3422.  
  3423.    conformant.  The meaning of this phrase is that it is assumed to be
  3424.    "safe" to send virtually any kind of properly-marked data to users of
  3425.    such mail systems, because such systems will at least be able to
  3426.    treat the data as undifferentiated binary, and will not simply splash
  3427.    it onto the screen of unsuspecting users.  There is another sense in
  3428.    which it is always "safe" to send data in a format that is MIME-
  3429.    conformant, which is that such data will not break or be broken by
  3430.    any known systems that are conformant with RFC 821 and RFC 822.  User
  3431.    agents that are MIME-conformant have the additional guarantee that
  3432.    the user will not be shown data that were never intended to be viewed
  3433.    as text.
  3434.  
  3435.  
  3436.  
  3437.  
  3438.  
  3439.  
  3440.  
  3441.  
  3442.  
  3443.  
  3444.  
  3445.  
  3446.  
  3447.  
  3448.  
  3449.  
  3450.  
  3451.  
  3452.  
  3453.  
  3454.  
  3455.  
  3456.  
  3457.  
  3458.  
  3459.  
  3460.  
  3461.  
  3462.  
  3463.  
  3464.  
  3465.  
  3466.  
  3467.  
  3468.  
  3469.  
  3470.  
  3471.  
  3472.  
  3473.  
  3474. Borenstein & Freed                                             [Page 62]
  3475.  
  3476. RFC 1521                          MIME                    September 1993
  3477.  
  3478.  
  3479. Appendix B -- General Guidelines For Sending Email Data
  3480.  
  3481.    Internet email is not a perfect, homogeneous system.  Mail may become
  3482.    corrupted at several stages in its travel to a final destination.
  3483.    Specifically, email sent throughout the Internet may travel across
  3484.    many networking technologies.  Many networking and mail technologies
  3485.    do not support the full functionality possible in the SMTP transport
  3486.    environment. Mail traversing these systems is likely to be modified
  3487.    in such a way that it can be transported.
  3488.  
  3489.    There exist many widely-deployed non-conformant MTAs in the Internet.
  3490.    These MTAs, speaking the SMTP protocol, alter messages on the fly to
  3491.    take advantage of the internal data structure of the hosts they are
  3492.    implemented on, or are just plain broken.
  3493.  
  3494.    The following guidelines may be useful to anyone devising a data
  3495.    format (Content-Type) that will survive the widest range of
  3496.    networking technologies and known broken MTAs unscathed.  Note that
  3497.    anything encoded in the base64 encoding will satisfy these rules, but
  3498.    that some well-known mechanisms, notably the UNIX uuencode facility,
  3499.    will not.  Note also that anything encoded in the Quoted-Printable
  3500.    encoding will survive most gateways intact, but possibly not some
  3501.    gateways to systems that use the EBCDIC character set.
  3502.  
  3503.       (1) Under some circumstances the encoding used for data may change
  3504.       as part of normal gateway or user agent operation. In particular,
  3505.       conversion from base64 to quoted-printable and vice versa may be
  3506.       necessary. This may result in the confusion of CRLF sequences with
  3507.       line breaks in text bodies. As such, the persistence of CRLF as
  3508.       something other than a line break must not be relied on.
  3509.  
  3510.       (2) Many systems may elect to represent and store text data using
  3511.       local newline conventions. Local newline conventions may not match
  3512.       the RFC822 CRLF convention -- systems are known that use plain CR,
  3513.       plain LF, CRLF, or counted records.  The result is that isolated
  3514.       CR and LF characters are not well tolerated in general; they may
  3515.       be lost or converted to delimiters on some systems, and hence must
  3516.       not be relied on.
  3517.  
  3518.       (3) TAB (HT) characters may be misinterpreted or may be
  3519.       automatically converted to variable numbers of spaces.  This is
  3520.       unavoidable in some environments, notably those not based on the
  3521.       ASCII character set. Such conversion is STRONGLY DISCOURAGED, but
  3522.       it may occur, and mail formats must not rely on the persistence of
  3523.       TAB (HT) characters.
  3524.  
  3525.       (4) Lines longer than 76 characters may be wrapped or truncated in
  3526.       some environments. Line wrapping and line truncation are STRONGLY
  3527.  
  3528.  
  3529.  
  3530. Borenstein & Freed                                             [Page 63]
  3531.  
  3532. RFC 1521                          MIME                    September 1993
  3533.  
  3534.  
  3535.       DISCOURAGED, but unavoidable in some cases. Applications which
  3536.       require long lines must somehow differentiate between soft and
  3537.       hard line breaks.  (A simple way to do this is to use the quoted-
  3538.       printable encoding.)
  3539.  
  3540.       (5) Trailing "white space" characters (SPACE, TAB (HT)) on a line
  3541.       may be discarded by some transport agents, while other transport
  3542.       agents may pad lines with these characters so that all lines in a
  3543.       mail file are of equal length.  The persistence of trailing white
  3544.       space, therefore, must not be relied on.
  3545.  
  3546.       (6) Many mail domains use variations on the ASCII character set,
  3547.       or use character sets such as EBCDIC which contain most but not
  3548.       all of the US-ASCII characters.  The correct translation of
  3549.       characters not in the "invariant" set cannot be depended on across
  3550.       character converting gateways.  For example, this situation is a
  3551.       problem when sending uuencoded information across BITNET, an
  3552.       EBCDIC system.  Similar problems can occur without crossing a
  3553.       gateway, since many Internet hosts use character sets other than
  3554.       ASCII internally.  The definition of Printable Strings in X.400
  3555.       adds further restrictions in certain special cases.  In
  3556.       particular, the only characters that are known to be consistent
  3557.       across all gateways are the 73 characters that correspond to the
  3558.       upper and lower case letters A-Z and a-z, the 10 digits 0-9, and
  3559.       the following eleven special characters:
  3560.  
  3561.                         "'"  (ASCII code 39)
  3562.                         "("  (ASCII code 40)
  3563.                         ")"  (ASCII code 41)
  3564.                         "+"  (ASCII code 43)
  3565.                         ","  (ASCII code 44)
  3566.                         "-"  (ASCII code 45)
  3567.                         "."  (ASCII code 46)
  3568.                         "/"  (ASCII code 47)
  3569.                         ":"  (ASCII code 58)
  3570.                         "="  (ASCII code 61)
  3571.                         "?"  (ASCII code 63)
  3572.  
  3573.       A maximally portable mail representation, such as the base64
  3574.       encoding, will confine itself to relatively short lines of text in
  3575.       which the only meaningful characters are taken from this set of 73
  3576.       characters.
  3577.  
  3578.       (7) Some mail transport agents will corrupt data that includes
  3579.       certain literal strings.  In particular, a period (".") alone on a
  3580.       line is known to be corrupted by some (incorrect) SMTP
  3581.       implementations, and a line that starts with the five characters
  3582.       "From " (the fifth character is a SPACE) are commonly corrupted as
  3583.  
  3584.  
  3585.  
  3586. Borenstein & Freed                                             [Page 64]
  3587.  
  3588. RFC 1521                          MIME                    September 1993
  3589.  
  3590.  
  3591.       well.  A careful composition agent can prevent these corruptions
  3592.       by encoding the data (e.g., in the quoted-printable encoding,
  3593.       "=46rom " in place of "From " at the start of a line, and "=2E" in
  3594.       place of "." alone on a line.
  3595.  
  3596.    Please note that the above list is NOT a list of recommended
  3597.    practices for MTAs.  RFC 821 MTAs are prohibited from altering the
  3598.    character of white space or wrapping long lines.  These BAD and
  3599.    illegal practices are known to occur on established networks, and
  3600.    implementations should be robust in dealing with the bad effects they
  3601.    can cause.
  3602.  
  3603.  
  3604.  
  3605.  
  3606.  
  3607.  
  3608.  
  3609.  
  3610.  
  3611.  
  3612.  
  3613.  
  3614.  
  3615.  
  3616.  
  3617.  
  3618.  
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.  
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.  
  3635.  
  3636.  
  3637.  
  3638.  
  3639.  
  3640.  
  3641.  
  3642. Borenstein & Freed                                             [Page 65]
  3643.  
  3644. RFC 1521                          MIME                    September 1993
  3645.  
  3646.  
  3647. Appendix C -- A Complex Multipart Example
  3648.  
  3649.    What follows is the outline of a complex multipart message.  This
  3650.    message has five parts to be displayed serially: two introductory
  3651.    plain text parts, an embedded multipart message, a richtext part, and
  3652.    a closing encapsulated text message in a non-ASCII character set.
  3653.    The embedded multipart message has two parts to be displayed in
  3654.    parallel, a picture and an audio fragment.
  3655.  
  3656.       MIME-Version: 1.0
  3657.       From: Nathaniel Borenstein <nsb@bellcore.com>
  3658.       To: Ned Freed <ned@innosoft.com>
  3659.       Subject: A multipart example
  3660.       Content-Type: multipart/mixed;
  3661.            boundary=unique-boundary-1
  3662.  
  3663.       This is the preamble area of a multipart message.
  3664.       Mail readers that understand multipart format
  3665.       should ignore this preamble.
  3666.       If you are reading this text, you might want to
  3667.       consider changing to a mail reader that understands
  3668.       how to properly display multipart messages.
  3669.       --unique-boundary-1
  3670.  
  3671.          ...Some text appears here...
  3672.       [Note that the preceding blank line means
  3673.       no header fields were given and this is text,
  3674.       with charset US ASCII.  It could have been
  3675.       done with explicit typing as in the next part.]
  3676.  
  3677.       --unique-boundary-1
  3678.       Content-type: text/plain; charset=US-ASCII
  3679.  
  3680.       This could have been part of the previous part,
  3681.       but illustrates explicit versus implicit
  3682.       typing of body parts.
  3683.  
  3684.       --unique-boundary-1
  3685.       Content-Type: multipart/parallel;
  3686.            boundary=unique-boundary-2
  3687.  
  3688.  
  3689.       --unique-boundary-2
  3690.       Content-Type: audio/basic
  3691.       Content-Transfer-Encoding: base64
  3692.  
  3693.          ... base64-encoded 8000 Hz single-channel
  3694.              mu-law-format audio data goes here....
  3695.  
  3696.  
  3697.  
  3698. Borenstein & Freed                                             [Page 66]
  3699.  
  3700. RFC 1521                          MIME                    September 1993
  3701.  
  3702.  
  3703.       --unique-boundary-2
  3704.       Content-Type: image/gif
  3705.       Content-Transfer-Encoding: base64
  3706.  
  3707.          ... base64-encoded image data goes here....
  3708.  
  3709.       --unique-boundary-2--
  3710.  
  3711.       --unique-boundary-1
  3712.       Content-type: text/richtext
  3713.  
  3714.       This is <bold><italic>richtext.</italic></bold>
  3715.       <smaller>as defined in RFC 1341</smaller>
  3716.       <nl><nl>Isn't it
  3717.       <bigger><bigger>cool?</bigger></bigger>
  3718.  
  3719.       --unique-boundary-1
  3720.       Content-Type: message/rfc822
  3721.  
  3722.       From: (mailbox in US-ASCII)
  3723.       To: (address in US-ASCII)
  3724.       Subject: (subject in US-ASCII)
  3725.       Content-Type: Text/plain; charset=ISO-8859-1
  3726.       Content-Transfer-Encoding: Quoted-printable
  3727.  
  3728.          ... Additional text in ISO-8859-1 goes here ...
  3729.  
  3730.       --unique-boundary-1--
  3731.  
  3732.  
  3733.  
  3734.  
  3735.  
  3736.  
  3737.  
  3738.  
  3739.  
  3740.  
  3741.  
  3742.  
  3743.  
  3744.  
  3745.  
  3746.  
  3747.  
  3748.  
  3749.  
  3750.  
  3751.  
  3752.  
  3753.  
  3754. Borenstein & Freed                                             [Page 67]
  3755.  
  3756. RFC 1521                          MIME                    September 1993
  3757.  
  3758.  
  3759. Appendix D -- Collected Grammar
  3760.  
  3761.    This appendix contains the complete BNF grammar for all the syntax
  3762.    specified by this document.
  3763.  
  3764.    By itself, however, this grammar is incomplete.  It refers to several
  3765.    entities that are defined by RFC 822.  Rather than reproduce those
  3766.    definitions here, and risk unintentional differences between the two,
  3767.    this document simply refers the reader to RFC 822 for the remaining
  3768.    definitions.  Wherever a term is undefined, it refers to the RFC 822
  3769.    definition.
  3770.  
  3771.    application-subtype := ("octet-stream" *stream-param)
  3772.                        / "postscript" / extension-token
  3773.  
  3774.    application-type :=  "application" "/" application-subtype
  3775.  
  3776.    attribute := token    ; case-insensitive
  3777.  
  3778.    atype := "ftp" / "anon-ftp" / "tftp" / "local-file"
  3779.                   / "afs" / "mail-server" / extension-token
  3780.                   ; Case-insensitive
  3781.  
  3782.    audio-type := "audio" "/" ("basic" / extension-token)
  3783.  
  3784.    body-part := <"message" as defined in RFC 822,
  3785.             with all header fields optional, and with the
  3786.             specified delimiter not occurring anywhere in
  3787.             the message body, either on a line by itself
  3788.             or as a substring anywhere.>
  3789.  
  3790.       NOTE: In certain transport enclaves, RFC 822 restrictions such as
  3791.       the one that limits bodies to printable ASCII characters may not
  3792.       be in force.  (That is, the transport domains may resemble
  3793.       standard Internet mail transport as specified in RFC821 and
  3794.       assumed by RFC822, but without certain restrictions.)  The
  3795.       relaxation of these restrictions should be construed as locally
  3796.       extending the definition of bodies, for example to include octets
  3797.       outside of the ASCII range, as long as these extensions are
  3798.       supported by the transport and adequately documented in the
  3799.       Content-Transfer-Encoding header field. However, in no event are
  3800.       headers (either message headers or body-part headers) allowed to
  3801.       contain anything other than ASCII characters.
  3802.  
  3803.  
  3804.  
  3805.  
  3806.  
  3807.  
  3808.  
  3809.  
  3810. Borenstein & Freed                                             [Page 68]
  3811.  
  3812. RFC 1521                          MIME                    September 1993
  3813.  
  3814.  
  3815.    boundary := 0*69<bchars> bcharsnospace
  3816.  
  3817.    bchars := bcharsnospace / " "
  3818.  
  3819.    bcharsnospace :=    DIGIT / ALPHA / "'" / "(" / ")" / "+"  / "_"
  3820.                   / "," / "-" / "." / "/" / ":" / "=" / "?"
  3821.  
  3822.    charset := "us-ascii" / "iso-8859-1" / "iso-8859-2"/ "iso-8859-3"
  3823.         / "iso-8859-4" / "iso-8859-5" /  "iso-8859-6" / "iso-8859-7"
  3824.         / "iso-8859-8" / "iso-8859-9" / extension-token
  3825.         ; case insensitive
  3826.  
  3827.    close-delimiter := "--" boundary "--" CRLF;Again,no space by "--",
  3828.  
  3829.    content  := "Content-Type"  ":" type "/" subtype  *(";" parameter)
  3830.              ; case-insensitive matching of type and subtype
  3831.  
  3832.    delimiter := "--" boundary CRLF  ;taken from Content-Type field.
  3833.                                 ; There must be no space
  3834.                                 ; between "--" and boundary.
  3835.  
  3836.    description := "Content-Description" ":" *text
  3837.  
  3838.    discard-text := *(*text CRLF)
  3839.  
  3840.    encapsulation := delimiter body-part CRLF
  3841.  
  3842.    encoding := "Content-Transfer-Encoding" ":" mechanism
  3843.  
  3844.    epilogue := discard-text        ;  to  be  ignored upon receipt.
  3845.  
  3846.    extension-token :=  x-token / iana-token
  3847.  
  3848.    external-param :=   (";" "access-type" "=" atype)
  3849.                   / (";" "expiration" "=" date-time)
  3850.  
  3851.                        ; Note that date-time is quoted
  3852.                   / (";" "size" "=" 1*DIGIT)
  3853.                   / (";"  "permission"  "="  ("read" / "read-write"))
  3854.                        ; Permission is case-insensitive
  3855.                   / (";" "name" "="  value)
  3856.                   / (";" "site" "=" value)
  3857.                   / (";" "dir" "=" value)
  3858.                   / (";" "mode" "=" value)
  3859.                   / (";" "server" "=" value)
  3860.                   / (";" "subject" "=" value)
  3861.            ;access-type required; others required based on access-type
  3862.  
  3863.  
  3864.  
  3865.  
  3866. Borenstein & Freed                                             [Page 69]
  3867.  
  3868. RFC 1521                          MIME                    September 1993
  3869.  
  3870.  
  3871.    iana-token := <a publicly-defined extension token,
  3872.              registered with IANA, as specified in
  3873.              appendix E>
  3874.  
  3875.    id :=  "Content-ID" ":" msg-id
  3876.  
  3877.    image-type := "image" "/" ("gif" / "jpeg" / extension-token)
  3878.  
  3879.    mechanism :=     "7bit"    ;  case-insensitive
  3880.                   / "quoted-printable"
  3881.                   / "base64"
  3882.                   / "8bit"
  3883.                   / "binary"
  3884.                   / x-token
  3885.  
  3886.    message-subtype := "rfc822"
  3887.                   / "partial" 2#3partial-param
  3888.                   / "external-body" 1*external-param
  3889.                   / extension-token
  3890.  
  3891.    message-type := "message" "/" message-subtype
  3892.  
  3893.    multipart-body :=preamble 1*encapsulation close-delimiter epilogue
  3894.  
  3895.    multipart-subtype := "mixed" / "parallel" / "digest"
  3896.                   / "alternative" / extension-token
  3897.  
  3898.    multipart-type := "multipart" "/" multipart-subtype
  3899.                   ";" "boundary" "=" boundary
  3900.  
  3901.    octet := "=" 2(DIGIT / "A" / "B" / "C" / "D" / "E" / "F")
  3902.         ; octet must be used for characters > 127, =, SPACE, or
  3903.    TAB,
  3904.         ; and is recommended for any characters not listed in
  3905.         ; Appendix B as "mail-safe".
  3906.  
  3907.    padding := "0" / "1" /  "2" /  "3" / "4" / "5" / "6" / "7"
  3908.  
  3909.    parameter := attribute "=" value
  3910.  
  3911.    partial-param :=     (";" "id" "=" value)
  3912.                   /  (";" "number" "=" 1*DIGIT)
  3913.                   /  (";" "total" "=" 1*DIGIT)
  3914.              ; id & number required;total required for last part
  3915.  
  3916.    preamble := discard-text       ;  to  be  ignored upon receipt.
  3917.  
  3918.    ptext := octet / <any ASCII character except "=", SPACE,  or TAB>
  3919.  
  3920.  
  3921.  
  3922. Borenstein & Freed                                             [Page 70]
  3923.  
  3924. RFC 1521                          MIME                    September 1993
  3925.  
  3926.  
  3927.         ; characters not listed as "mail-safe" in Appendix B
  3928.         ; are also not recommended.
  3929.  
  3930.    quoted-printable := ([*(ptext / SPACE /  TAB)  ptext]  ["="] CRLF)
  3931.         ; Maximum line length of 76 characters excluding CRLF
  3932.  
  3933.    stream-param :=  (";" "type" "=" value)
  3934.                 / (";" "padding" "=" padding)
  3935.  
  3936.    subtype := token  ; case-insensitive
  3937.  
  3938.    text-subtype := "plain" / extension-token
  3939.  
  3940.    text-type := "text" "/" text-subtype [";" "charset" "=" charset]
  3941.  
  3942.    token  :=  1*<any  (ASCII) CHAR except SPACE, CTLs, or tspecials>
  3943.  
  3944.    tspecials :=  "(" / ")" / "<" / ">" / "@"
  3945.               /  "," / ";" / ":" / "\" / <">
  3946.               /  "/" / "[" / "]" / "?" / "="
  3947.              ; Must be in quoted-string,
  3948.              ; to use within parameter values
  3949.  
  3950.  
  3951.    type :=     "application"     /  "audio"   ; case-insensitive
  3952.              / "image"           / "message"
  3953.              / "multipart"  / "text"
  3954.              / "video"           / extension-token
  3955.              ; All values case-insensitive
  3956.  
  3957.    value := token / quoted-string
  3958.  
  3959.    version := "MIME-Version" ":" 1*DIGIT "." 1*DIGIT
  3960.  
  3961.    video-type := "video" "/" ("mpeg" / extension-token)
  3962.  
  3963.    x-token := <The two characters "X-" or "x-" followed, with no
  3964.               intervening white space, by any token>
  3965.  
  3966.  
  3967.  
  3968.  
  3969.  
  3970.  
  3971.  
  3972.  
  3973.  
  3974.  
  3975.  
  3976.  
  3977.  
  3978. Borenstein & Freed                                             [Page 71]
  3979.  
  3980. RFC 1521                          MIME                    September 1993
  3981.  
  3982.  
  3983. Appendix E -- IANA Registration Procedures
  3984.  
  3985.    MIME has been carefully designed to have extensible mechanisms, and
  3986.    it is expected that the set of content-type/subtype pairs and their
  3987.    associated parameters will grow significantly with time.  Several
  3988.    other MIME fields, notably character set names, access-type
  3989.    parameters for the message/external-body type, and possibly even
  3990.    Content-Transfer-Encoding values, are likely to have new values
  3991.    defined over time.  In order to ensure that the set of such values is
  3992.    developed in an orderly, well-specified, and public manner, MIME
  3993.    defines a registration process which uses the Internet Assigned
  3994.    Numbers Authority (IANA) as a central registry for such values.
  3995.  
  3996.    In general, parameters in the content-type header field are used to
  3997.    convey supplemental information for various content types, and their
  3998.    use is defined when the content-type and subtype are defined.  New
  3999.    parameters should not be defined as a way to introduce new
  4000.    functionality.
  4001.  
  4002.    In order to simplify and standardize the registration process, this
  4003.    appendix gives templates for the registration of new values with
  4004.    IANA.  Each of these is given in the form of an email message
  4005.    template, to be filled in by the registering party.
  4006.  
  4007.    E.1  Registration of New Content-type/subtype Values
  4008.  
  4009.    Note that MIME is generally expected to be extended by subtypes.  If
  4010.    a new fundamental top-level type is needed, its specification must be
  4011.    published as an RFC or submitted in a form suitable to become an RFC,
  4012.    and be subject to the Internet standards process.
  4013.  
  4014.       To:  IANA@isi.edu
  4015.       Subject:  Registration of new MIME
  4016.            content-type/subtype
  4017.  
  4018.       MIME type name:
  4019.  
  4020.       (If the above is not an existing top-level MIME type,
  4021.       please explain why an existing type cannot be used.)
  4022.  
  4023.       MIME subtype name:
  4024.  
  4025.       Required parameters:
  4026.  
  4027.       Optional parameters:
  4028.  
  4029.       Encoding considerations:
  4030.  
  4031.  
  4032.  
  4033.  
  4034. Borenstein & Freed                                             [Page 72]
  4035.  
  4036. RFC 1521                          MIME                    September 1993
  4037.  
  4038.  
  4039.       Security considerations:
  4040.  
  4041.       Published specification:
  4042.  
  4043.       (The published specification must be an Internet RFC or
  4044.       RFC-to-be if a new top-level type is being defined, and
  4045.       must be a publicly available specification in any
  4046.       case.)
  4047.  
  4048.       Person & email address to contact for further information:
  4049.  
  4050.    E.2  Registration of New Access-type Values
  4051.            for Message/external-body
  4052.  
  4053.       To:  IANA@isi.edu
  4054.       Subject:  Registration of new MIME Access-type for
  4055.            Message/external-body content-type
  4056.  
  4057.       MIME access-type name:
  4058.  
  4059.       Required parameters:
  4060.  
  4061.       Optional parameters:
  4062.  
  4063.       Published specification:
  4064.  
  4065.       (The published specification must be an Internet RFC or
  4066.       RFC-to-be.)
  4067.  
  4068.       Person & email address to contact for further information:
  4069.  
  4070.  
  4071.  
  4072.  
  4073.  
  4074.  
  4075.  
  4076.  
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.  
  4090. Borenstein & Freed                                             [Page 73]
  4091.  
  4092. RFC 1521                          MIME                    September 1993
  4093.  
  4094.  
  4095. Appendix F -- Summary of the Seven Content-types
  4096.  
  4097.    Content-type: text
  4098.  
  4099.    Subtypes defined by this document:  plain
  4100.  
  4101.    Important Parameters: charset
  4102.  
  4103.    Encoding notes: quoted-printable generally preferred if an encoding
  4104.       is needed and the character set is mostly an ASCII superset.
  4105.  
  4106.    Security considerations: Rich text formats such as TeX and Troff
  4107.       often contain mechanisms for executing arbitrary commands or file
  4108.       system operations, and should not be used automatically unless
  4109.       these security problems have been addressed.  Even plain text may
  4110.       contain control characters that can be used to exploit the
  4111.       capabilities of "intelligent" terminals and cause security
  4112.       violations.  User interfaces designed to run on such terminals
  4113.       should be aware of and try to prevent such problems.
  4114.  
  4115.    ________________________________________________________
  4116.    Content-type: multipart
  4117.  
  4118.    Subtypes defined by  this  document: mixed, alternative,
  4119.         digest, parallel.
  4120.  
  4121.    Important Parameters: boundary
  4122.  
  4123.    Encoding notes: No content-transfer-encoding is permitted.
  4124.  
  4125.    ________________________________________________________
  4126.    Content-type: message
  4127.  
  4128.    Subtypes defined by this document: rfc822, partial, external-body
  4129.  
  4130.    Important Parameters: id, number, total, access-type, expiration,
  4131.       size, permission, name, site, directory, mode, server, subject
  4132.  
  4133.    Encoding notes: No content-transfer-encoding is permitted.
  4134.       Specifically, only "7bit" is permitted for "message/partial" or
  4135.       "message/external-body", and only "7bit", "8bit", or "binary" are
  4136.       permitted for other subtypes of "message".
  4137.    ______________________________________________________________
  4138.    Content-type: application
  4139.  
  4140.    Subtypes defined by this document:  octet-stream, postscript
  4141.  
  4142.    Important Parameters:  type, padding
  4143.  
  4144.  
  4145.  
  4146. Borenstein & Freed                                             [Page 74]
  4147.  
  4148. RFC 1521                          MIME                    September 1993
  4149.  
  4150.  
  4151.    Deprecated Parameters: name and conversions were
  4152.                           defined in RFC 1341.
  4153.  
  4154.    Encoding notes: base64 preferred for unreadable subtypes.
  4155.  
  4156.    Security considerations:  This  type  is  intended  for  the
  4157.    transmission  of data to be interpreted by locally-installed
  4158.    programs.  If used,  for  example,  to  transmit  executable
  4159.    binary  programs  or programs in general-purpose interpreted
  4160.    languages, such as LISP programs or  shell  scripts,  severe
  4161.    security  problems  could  result.   Authors of mail-reading
  4162.    agents are cautioned against giving their systems the  power
  4163.    to  execute  mail-based  application  data without carefully
  4164.    considering  the  security  implications.    While   it   is
  4165.    certainly  possible  to  define safe application formats and
  4166.    even safe interpreters for unsafe formats, each  interpreter
  4167.    should   be   evaluated  separately  for  possible  security
  4168.    problems.
  4169.    ________________________________________________________________
  4170.    Content-type: image
  4171.  
  4172.    Subtypes defined by this document:  jpeg, gif
  4173.  
  4174.    Important Parameters: none
  4175.  
  4176.    Encoding notes: base64 generally preferred
  4177.    ________________________________________________________________
  4178.    Content-type: audio
  4179.  
  4180.    Subtypes defined by this document:  basic
  4181.  
  4182.    Important Parameters: none
  4183.  
  4184.    Encoding notes: base64 generally preferred
  4185.    ________________________________________________________________
  4186.    Content-type: video
  4187.  
  4188.    Subtypes defined by this document:  mpeg
  4189.  
  4190.    Important Parameters: none
  4191.  
  4192.    Encoding notes: base64 generally preferred
  4193.  
  4194.  
  4195.  
  4196.  
  4197.  
  4198.  
  4199.  
  4200.  
  4201.  
  4202. Borenstein & Freed                                             [Page 75]
  4203.  
  4204. RFC 1521                          MIME                    September 1993
  4205.  
  4206.  
  4207. Appendix G -- Canonical Encoding Model
  4208.  
  4209.    There was some confusion, in earlier drafts of this memo, regarding
  4210.    the model for when email data was to be converted to canonical form
  4211.    and encoded, and in particular how this process would affect the
  4212.    treatment of CRLFs, given that the representation of newlines varies
  4213.    greatly from system to system.  For this reason, a canonical model
  4214.    for encoding is presented below.
  4215.  
  4216.    The process of composing a MIME entity can be modeled as being done
  4217.    in a number of steps.  Note that these steps are roughly similar to
  4218.    those steps used in RFC 1421 and are performed for each 'innermost
  4219.    level' body:
  4220.  
  4221.    Step 1.  Creation of local form.
  4222.  
  4223.    The body to be transmitted is created in the system's native format.
  4224.    The native character set is used, and where appropriate local end of
  4225.    line conventions are used as well.  The body may be a UNIX-style text
  4226.    file, or a Sun raster image, or a VMS indexed file, or audio data in
  4227.    a system-dependent format stored only in memory, or anything else
  4228.    that corresponds to the local model for the representation of some
  4229.    form of information.  Fundamentally, the data is created in the
  4230.    "native" form specified by the type/subtype information.
  4231.  
  4232.    Step 2.  Conversion to canonical form.
  4233.  
  4234.    The entire body, including "out-of-band" information such as record
  4235.    lengths and possibly file attribute information, is converted to a
  4236.    universal canonical form.  The specific content type of the body as
  4237.    well as its associated attributes dictate the nature of the canonical
  4238.    form that is used.  Conversion to the proper canonical form may
  4239.    involve character set conversion, transformation of audio data,
  4240.    compression, or various other operations specific to the various
  4241.    content types.  If character set conversion is involved, however,
  4242.    care must be taken to understand the semantics of the content-type,
  4243.    which may have strong implications for any character set conversion,
  4244.    e.g.  with regard to syntactically meaningful characters in a text
  4245.    subtype other than "plain".
  4246.  
  4247.    For example, in the case of text/plain data, the text must be
  4248.    converted to a supported character set and lines must be delimited
  4249.    with CRLF delimiters in accordance with RFC822.  Note that the
  4250.    restriction on line lengths implied by RFC822 is eliminated if the
  4251.    next step employs either quoted-printable or base64 encoding.
  4252.  
  4253.  
  4254.  
  4255.  
  4256.  
  4257.  
  4258. Borenstein & Freed                                             [Page 76]
  4259.  
  4260. RFC 1521                          MIME                    September 1993
  4261.  
  4262.  
  4263.    Step 3.  Apply transfer encoding.
  4264.  
  4265.    A Content-Transfer-Encoding appropriate for this body is applied.
  4266.    Note that there is no fixed relationship between the content type and
  4267.    the transfer encoding.  In particular, it may be appropriate to base
  4268.    the choice of base64 or quoted-printable on character frequency
  4269.    counts which are specific to a given instance of a body.
  4270.  
  4271.    Step 4.  Insertion into entity.
  4272.  
  4273.    The encoded object is inserted into a MIME entity with appropriate
  4274.    headers.  The entity is then inserted into the body of a higher-level
  4275.    entity (message or multipart) if needed.
  4276.  
  4277.    It is vital to note that these steps are only a model; they are
  4278.    specifically NOT a blueprint for how an actual system would be built.
  4279.    In particular, the model fails to account for two common designs:
  4280.  
  4281.       1.  In many cases the conversion to a canonical form prior to
  4282.       encoding will be subsumed into the encoder itself, which
  4283.       understands local formats directly.  For example, the local
  4284.       newline convention for text bodies might be carried through to the
  4285.       encoder itself along with knowledge of what that format is.
  4286.  
  4287.       2.  The output of the encoders may have to pass through one or
  4288.       more additional steps prior to being transmitted as a message.  As
  4289.       such, the output of the encoder may not be conformant with the
  4290.       formats specified by RFC822.  In particular, once again it may be
  4291.       appropriate for the converter's output to be expressed using local
  4292.       newline conventions rather than using the standard RFC822 CRLF
  4293.       delimiters.
  4294.  
  4295.    Other implementation variations are conceivable as well.  The vital
  4296.    aspect of this discussion is that, in spite of any optimizations,
  4297.    collapsings of required steps, or insertion of additional processing,
  4298.    the resulting messages must be consistent with those produced by the
  4299.    model described here.  For example, a message with the following
  4300.    header fields:
  4301.  
  4302.         Content-type: text/foo; charset=bar
  4303.         Content-Transfer-Encoding: base64
  4304.  
  4305.    must be first represented in the text/foo form, then (if necessary)
  4306.    represented in the "bar" character set, and finally transformed via
  4307.    the base64 algorithm into a mail-safe form.
  4308.  
  4309.  
  4310.  
  4311.  
  4312.  
  4313.  
  4314. Borenstein & Freed                                             [Page 77]
  4315.  
  4316. RFC 1521                          MIME                    September 1993
  4317.  
  4318.  
  4319. Appendix H -- Changes from RFC 1341
  4320.  
  4321.    This document is a relatively minor revision  of  RFC  1341.  For
  4322.    the  convenience  of  those familiar with RFC 1341, the technical
  4323.    changes from that document are summarized in  this appendix.
  4324.  
  4325.    1.  The definition of "tspecials" has been changed to no longer
  4326.    include ".".
  4327.  
  4328.    2.  The Content-ID field is now mandatory for message/external-body
  4329.    parts.
  4330.  
  4331.    3.  The text/richtext type (including the old Section 7.1.3 and
  4332.    Appendix D) has been moved to a separate document.
  4333.  
  4334.    4.  The rules on header merging for message/partial data have been
  4335.    changed to treat the Encrypted and MIME-Version headers as special
  4336.    cases.
  4337.  
  4338.    5.  The definition of the external-body access-type parameter has
  4339.    been changed so that it can only indicate a single access method
  4340.    (which was all that made sense).
  4341.  
  4342.    6.  There is a new "Subject" parameter for message/external-body,
  4343.    access-type mail-server, to permit MIME-based use of mail servers
  4344.    that rely on Subject field information.
  4345.  
  4346.    7.  The "conversions" parameter for application/octet-stream has been
  4347.    removed.
  4348.  
  4349.    8.  Section 7.4.1 now deprecates the use of the "name" parameter for
  4350.    application/octet-stream, as this will be superseded in the future by
  4351.    a Content-Disposition header.
  4352.  
  4353.    9.  The formal grammar for multipart bodies has been changed so that
  4354.    a CRLF is no longer required before the first boundary line.
  4355.  
  4356.    10.  MIME entities of type "message/partial" and "message/external-
  4357.    body" are now required to use only the "7bit" transfer-encoding.
  4358.    (Specifically, "binary" and "8bit" are not permitted.)
  4359.  
  4360.    11.  The "application/oda" content-type has been removed.
  4361.  
  4362.    12.  A note has been added to the end of section 7.2.3, explaining
  4363.    the semantics of Content-ID in a multipart/alternative MIME entity.
  4364.  
  4365.    13.  The formal syntax for the "MIME-Version" field has been
  4366.    tightened, but in a way that is completely compatible with the only
  4367.  
  4368.  
  4369.  
  4370. Borenstein & Freed                                             [Page 78]
  4371.  
  4372. RFC 1521                          MIME                    September 1993
  4373.  
  4374.  
  4375.    version number defined in RFC 1341.
  4376.  
  4377.    14.  In Section 7.3.1, the definition of message/rfc822 has been
  4378.    relaxed regarding mandatory fields.
  4379.  
  4380.    All other changes from RFC 1341 were editorial changes and do not
  4381.    affect the technical content of MIME.  Considerable formal grammar
  4382.    has been added, but this reflects the prose specification that was
  4383.    already in place.
  4384.  
  4385.  
  4386.  
  4387.  
  4388.  
  4389.  
  4390.  
  4391.  
  4392.  
  4393.  
  4394.  
  4395.  
  4396.  
  4397.  
  4398.  
  4399.  
  4400.  
  4401.  
  4402.  
  4403.  
  4404.  
  4405.  
  4406.  
  4407.  
  4408.  
  4409.  
  4410.  
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417.  
  4418.  
  4419.  
  4420.  
  4421.  
  4422.  
  4423.  
  4424.  
  4425.  
  4426. Borenstein & Freed                                             [Page 79]
  4427.  
  4428. RFC 1521                          MIME                    September 1993
  4429.  
  4430.  
  4431. References
  4432.  
  4433.    [US-ASCII] Coded Character Set--7-Bit American Standard Code for
  4434.    Information Interchange, ANSI X3.4-1986.
  4435.  
  4436.    [ATK] Borenstein, Nathaniel S., Multimedia Applications Development
  4437.    with the Andrew Toolkit, Prentice-Hall, 1990.
  4438.  
  4439.    [GIF] Graphics Interchange Format (Version 89a), Compuserve, Inc.,
  4440.    Columbus, Ohio, 1990.
  4441.  
  4442.    [ISO-2022] International Standard--Information Processing--ISO 7-bit
  4443.    and 8-bit coded character sets--Code extension techniques, ISO
  4444.    2022:1986.
  4445.  
  4446.    [ISO-8859] Information Processing -- 8-bit Single-Byte Coded Graphic
  4447.    Character Sets -- Part 1: Latin Alphabet No. 1, ISO 8859-1:1987.  Part
  4448.    2: Latin alphabet No.  2, ISO 8859-2, 1987.  Part 3: Latin alphabet
  4449.    No. 3, ISO 8859-3, 1988.  Part 4: Latin alphabet No.  4, ISO 8859-4,
  4450.    1988.  Part 5: Latin/Cyrillic alphabet, ISO 8859-5, 1988.  Part 6:
  4451.    Latin/Arabic alphabet, ISO 8859-6, 1987.  Part 7: Latin/Greek
  4452.    alphabet, ISO 8859-7, 1987.  Part 8: Latin/Hebrew alphabet, ISO
  4453.    8859-8, 1988.  Part 9: Latin alphabet No. 5, ISO 8859-9, 1990.
  4454.  
  4455.    [ISO-646] International Standard--Information Processing--ISO 7-bit
  4456.    coded character set for information interchange, ISO 646:1983.
  4457.  
  4458.    [MPEG] Video Coding Draft Standard ISO 11172 CD, ISO IEC/TJC1/SC2/WG11
  4459.    (Motion Picture Experts Group), May, 1991.
  4460.  
  4461.    [PCM] CCITT, Fascicle III.4 - Recommendation G.711, Geneva, 1972,
  4462.    "Pulse Code Modulation (PCM) of Voice Frequencies".
  4463.  
  4464.    [POSTSCRIPT] Adobe Systems, Inc., PostScript Language Reference
  4465.    Manual, Addison-Wesley, 1985.
  4466.  
  4467.    [POSTSCRIPT2] Adobe Systems, Inc., PostScript Language Reference
  4468.    Manual, Addison-Wesley, Second Edition, 1990.
  4469.  
  4470.    [X400] Schicker, Pietro, "Message Handling Systems, X.400", Message
  4471.    Handling Systems and Distributed Applications, E.  Stefferud, O-j.
  4472.    Jacobsen, and P.  Schicker, eds., North-Holland, 1989, pp. 3-41.
  4473.  
  4474.    [RFC-783] Sollins, K., "TFTP Protocol (revision 2)", RFC 783, MIT,
  4475.    June 1981.
  4476.  
  4477.    [RFC-821] Postel, J., "Simple Mail Transfer Protocol", STD 10, RFC
  4478.    821, USC/Information Sciences Institute, August 1982.
  4479.  
  4480.  
  4481.  
  4482. Borenstein & Freed                                             [Page 80]
  4483.  
  4484. RFC 1521                          MIME                    September 1993
  4485.  
  4486.  
  4487.    [RFC-822] Crocker, D., "Standard for the Format of ARPA Internet Text
  4488.    Messages", STD 11, RFC 822, UDEL, August 1982.
  4489.  
  4490.    [RFC-934] Rose, M., and E. Stefferud, "Proposed Standard for Message
  4491.    Encapsulation", RFC 934, Delaware and NMA, January 1985.
  4492.  
  4493.    [RFC-959] Postel, J. and J. Reynolds, "File Transfer Protocol",
  4494.    STD 9, RFC 959, USC/Information Sciences Institute, October 1985.
  4495.  
  4496.    [RFC-1049] Sirbu, M., "Content-Type Header Field for Internet
  4497.    Messages", STD 11, RFC 1049, CMU, March 1988.
  4498.  
  4499.    [RFC-1421] Linn, J., "Privacy Enhancement for Internet Electronic Mail:
  4500.    Part I - Message Encryption and Authentication Procedures", RFC
  4501.    1421, IAB IRTF PSRG, IETF PEM WG, February 1993.
  4502.  
  4503.    [RFC-1154] Robinson, D. and R. Ullmann, "Encoding Header Field for
  4504.    Internet Messages", RFC 1154, Prime Computer, Inc., April 1990.
  4505.  
  4506.    [RFC-1341] Borenstein, N., and N.  Freed, "MIME (Multipurpose Internet
  4507.    Mail Extensions): Mechanisms for Specifying and Describing the Format
  4508.    of Internet Message Bodies", RFC 1341, Bellcore, Innosoft, June 1992.
  4509.  
  4510.    [RFC-1342] Moore, K., "Representation of Non-Ascii Text in Internet
  4511.    Message Headers", RFC 1342, University of Tennessee, June 1992.
  4512.  
  4513.    [RFC-1343] Borenstein, N., "A User Agent Configuration Mechanism
  4514.    for Multimedia Mail Format Information", RFC 1343, Bellcore, June
  4515.    1992.
  4516.  
  4517.    [RFC-1344] Borenstein, N., "Implications of MIME for Internet
  4518.    Mail Gateways", RFC 1344, Bellcore, June 1992.
  4519.  
  4520.    [RFC-1345] Simonsen, K., "Character Mnemonics & Character Sets",
  4521.    RFC 1345, Rationel Almen Planlaegning, June 1992.
  4522.  
  4523.    [RFC-1426] Klensin, J., (WG Chair), Freed, N., (Editor), Rose, M.,
  4524.    Stefferud, E., and D. Crocker, "SMTP Service Extension for 8bit-MIME
  4525.    transport", RFC 1426, United Nations Universit, Innosoft, Dover Beach
  4526.    Consulting, Inc., Network Management Associates, Inc., The Branch
  4527.    Office, February 1993.
  4528.  
  4529.    [RFC-1522] Moore, K., "Representation of Non-Ascii Text in Internet
  4530.    Message Headers" RFC 1522, University of Tennessee, September 1993.
  4531.  
  4532.    [RFC-1340] Reynolds, J., and J. Postel, "Assigned Numbers", STD 2, RFC
  4533.    1340, USC/Information Sciences Institute, July 1992.
  4534.  
  4535.  
  4536.  
  4537.  
  4538. Borenstein & Freed                                             [Page 81]
  4539.