MH & nmh: Email for Users & Programmers

May, 2006

MIME Reference Guide

This section is for MIME users. The Section Some MIME Content Types and Subtypes -- which applies to MH, MH-E; and exmh -- lists some MIME content types and subtypes. The Section Syntax of MIME Draft Directives lists MIME directives; this is handy for MH, MH-E, and exmh users who are composing MIME messages. However, MH-E users are more likely to use the commands described in Section Adding Attachments of The MH-E Manual to insert MML (MIME Meta Language) tags.

Some MIME Content Types and Subtypes

The tables in this section summarize the content-types defined in RFC 1521. (RFC 1521 has been replaced by RFC 2045 and other MIME RFCs. If you want to see the latest information, there are links from the Reference List.) The tables are overviews for quick reference. They aren't complete: for instance, some subtypes have restrictions that are hard to list in a brief table format.

There's a complete and up-to-date list of standard content types and subtypes available by anonymous FTP from in the directory /in-notes/iana/assignments/media-types. The media-types directory contains a subdirectory for each content type; each of those directories contains a file for each content subtype. Note that there are some non-standard contents, like image/X-pbm, that are widely used.

text Content-type

    text/plain                Text meant to be read by a person
    text/richtext             Obsolete; replaced by text/enriched
    text/enriched             Text with structure and font
                              information coded in plain ASCII

        ; charset             Character set
              =us-ascii       Default 7-bit ASCII (ANSI X3.4-1986)
              =iso-8859-n     ISO international character set
                              number n (1 thru 9)
              =iso-2022-xx    xx is JP for Japan (RFC 1468),
                              KR for Korea
              =X-something    Experimental, non-standard extension

message Content-type

    message/rfc822            Body of message is structured in RFC 822
                              format (such as a forwarded message)

    message/partial           Message has been split into several parts
       ; id=                  Unique identifier for matching parts
       ; number=              Location (1, 2, 3, etc.) of this part in all parts
       ; total=               Total number of parts

    message/external-body     Data not included in message. May be cached
                              locally.  Must have Content-ID: header field.
       ; access-type=         How to access external body part
           ftp                File Transfer Protocol (RFC 959)
           tftp               Trivial File Transfer Protocol (RFC 783)
           anon-ftp           Anonymous FTP
           local-file         On recipient's local filesystem
           afs                Andrew filesystem
           mail-server        An email file server
           X-something        Experimental, non-standard extension
       ; expiration=          (Optional) after this date, source data
                              may be deleted
       ; size=                (Optional) size of data, in octets
       ; permission=          (Optional)
            read              local cache will always be valid
            read-write        data may change; local cache may be invalid

application Content-type

    application/octet-stream  Uninterpreted data or data for an application
       ; type=                General category of binary data
       ; padding=             Number of bits of padding appended

    application/oda           Open Document Interchange Format (ODIF)

    application/postscript    Adobe PostScript

    application/X-something   Experimental, non-standard extension

audio Content-type

    audio/basic               u-law (telephone-quality) sound

image Content-type

    image/jpeg                JPEG-format image
    image/gif                 GIF-format image
    image/x-xwd               X11 Window System Window Dump format (non-standard)
    image/x-pbm               Portable Bitmap format (non-standard)
    image/X-something         Experimental, non-standard extension

video Content-type

    video/mpeg                Video in MPEG format (ISO 11172 CD, May 1991)
    video/X-something         Experimental, non-standard extension
                              (may include synchronized audio)

multipart Content-type

    multipart/mixed           One or more content-types in a particular order
    multipart/alternative     Interchangeable parts, from simplest to most-faithful
    multipart/digest          Default content-type is message/rfc822
    multipart/parallel        Output all parts simultaneously, if possible

X-something Content-type

    X-something/subtype       Experimental, non-standard extension

Syntax of MIME Draft Directives

The mhn(1) and mhbuild(1) manual pages have a precise explanation of the syntax of directives. This section is adapted from the mhn manual page.

A directive starts with a hash mark (#) as the first character of the line. A directive should fit on a single line unless you continue the directive by ending the line with a backslash (\). The tables in the Section Some MIME Content Types and Subtypes list some MIME types and subtypes.

Note that mhn will accept some invalid content-type directives like #<text/plane.

In the tables below, read down the first column for the parts of each directive. The second column tells how many of that part are needed: the value zero (0) means the part is not required. The third column describes the part. Type the parts you choose in the order given. As you saw at the top of the Section MIME Draft Directives, you can enter all the parts of a directive on one line -- or continue on another line, using a backslash.

Table 1. Type Directive for Files #

    Part                Quantity    Description
    #type/subtype       1           Content type and subtype
    ;attribute=value    0 or more   Parameters for Content-Type:
    (comment)           0 or 1      Comment for Content-Type:
    <id>                0 or 1      Content-ID: to replace default
    [description]       0 or 1      Content-Description:
    filename            0 or 1      Content file to read. If none, use the 
                                    composition string.

Table 2. Type Directive for Text in Draft #<

    Part                Quantity    Description
    #<type/subtype      1           Content type and subtype
    ;attribute=value    0 or more   Parameters for Content-Type:
    (comment)           0 or 1      Comment for Content-Type:
    [description]       0 or 1      Content-Description:
    end of line         1           Directive must end before text begins
    lines of text       1 or more   Text for body part
    #                   0 or 1      Hash mark to signal end of body part

Table 3. External-type Directive #@

    Part                Quantity    Description
    #@type/subtype      1           Content type and subtype
    ;attribute=value    0 or more   Parameters for mhn, mhbuild
    (comment)           0 or 1      Comment for Content-Type:
    <id>                0 or 1      Content-ID: to replace default
    [description]       1           Content-Description:
    ;attribute=value    1 or more   Parameters for external body part

Table 4. Message Directive: #forw

    Part                Quantity    Description
    #forw               1           Message-forwarding directive (creates
                                    message/rfc822 or multipart/digest
    <id>                0 or 1      Content-ID: to replace default
    [description]       1           Content-Description:
    +folder             0 or 1      MH folder to read (default = current)
    msgs                0 or more   MH message numbers, ranges, sequences
                                    (default = current message)

Table 5. Multiple Directives: #begin, #end

    Part                Quantity    Description
    #begin              1           Begin multipart content
    <id>                0 or 1      Content-ID: to replace default
    [description]       1           Content-Description:
    alternative         1           Multipart content subtype
    parallel                            "        "       "
    something                           "        "       "
    end of line         1           Directive must end before others
    #directive(s)       1 or more   Directives (and any text) for
                                    included parts
    #end                1           End multipart content