Skip to main content

Overall Format of a Mailcap File

Each mailcap file consists of a set of entries that describe the proper handling of one media type at the local site. For example, one line might tell how to display a message in Group III fax format. A mailcap file consists of a sequence of such individual entries, separated by newlines (according to the operating system's newline conventions). Blank lines and lines that start with the "#" character (ASCII 35) are considered comments, and are ignored. Long entries may be continued on multiple lines if each non-terminal line ends with a backslash character ('', ASCII 92), in which case the multiple lines are to be treated as a single mailcap entry. Note that for such "continued" lines, the backslash must be the last character on the line to be continued.

Thus the overall format of a mailcap file is given, in the modified BNF of RFC 822, as:

Mailcap-File = *Mailcap-Line

Mailcap-Line = Comment / Mailcap-Entry

Comment = NEWLINE / "#" *CHAR NEWLINE

NEWLINE = <newline as defined by OS convention>

Note that the above specification implies that comments must appear on lines all to themselves, with a "#" character as the first character on each comment line.