# Mailcap Files

The "mailcap" format is formally defined by RFC 1524.

Basically, a mailcap file is a configuration file that maps MIME types to external viewers. (MIME is defined by RFC 1521.) An example would be mapping MIME type `image/gif` to the image viewer "xv".

Here is an example mailcap file:

    # This is a simple example mailcap file.
    # Lines starting with '#' are comments.

    # This maps all types of audio data (audio/basic, audio/x-aiff,
    # etc.) to the viewer 'showaudio'.  Note that '%s' means 'put the
    # datafile name here when the viewer is executed'.
    audio/*; showaudio %s

    # This maps all types of images (image/gif, image/jpeg, etc.)
    # to the viewer 'xv'.
    image/*; xv %s

    # This maps MPEG video data to the viewer 'mpeg_play'.
    video/mpeg; mpeg_play %s

    # This maps all types of video *other than MPEG* to the viewer
    # 'genericmovie'.
    video/*; genericmovie %s

    application/postscript; ghostview %s
    application/x-dvi; xdvi %s

Besides Mosaic, mailcap files are used by MIME-capable multimedia mail handlers, including the famous 'metamail' (available here).

## Where Do Mailcap Files Go?

There can be a global mailcap; the X resource `globalTypeMap` gives the filename. The default is "/usr/local/lib/mosaic/mailcap". This is generally the location for system- or site-wide viewer configuration.

There can also be a personal mailcap; the X resource `personalTypeMap` gives the filename (the value of the environment variable `HOME` is prepended to this). The default is ".mailcap". This is generally the location for per-user configuration.

Note that Mosaic is configured to map some MIME types to viewers by default. To turn off these defaults, set the X resource `useDefaultTypeMap` to false. We strongly recommend that this resource be left true; simply override as necessary.

Entries in the personal mailcap take precedence over entries in the global mailcap, which in turn take precedence over the built-in defaults.

## More on MIME Types

A canonical list of official and unofficial (experimental) MIME types used in Mosaic and the Web is kept by Tony Sanders.

Official MIME types are those registered with the "Internet Assigned Numbers Authority", a central technical identifier registry. An up-to-date list of official, registered MIME types and associated specs (or pointers to specs) maintained by the IANA is here.

Unofficial, or experimental MIME types, are denoted by having the subtype begin with the string `'x-'`. Therefore, since AIFF audio is not yet a registered MIME type, the unofficial MIME type is usually `audio/x-aiff`. (If and when AIFF is registered with the IANA, the MIME type it is assigned will then likely be `audio/aiff`.)

## Related Information

For information on how to map file extensions to MIME types in Mosaic, see here.

For the list of MIME types recognized by default by Mosaic 2.0pre4, see here.