Implementation Under Unix Operating Systems

Parts of the mailcap file format are operating system dependent. Mostly, this is due to the semantics of local command execution. There are a few other issues, such as where the mailcap file is kept.

Under Unix operating systems, all program commands in the view, compose, composetyped, edit, print, test fields are represented as complete program command lines (with parameters) as if they were implicitly preceded by “/bin/sh -c”.

The location of the mailcap file is defined for Unix. First, any application looking for a mailcap file should check the MAILCAPS environment variable. Next, it should check at least the following path, although a longer path may be checked as well:

$HOME/.mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap

Under Unix, some handy substitution variables may be used in a mailcap file, as shown in Table 8-2. They are meant to allow program command lines and other fields to take the appropriate temporary filename, Content-type, or Content-type parameters as arguments at the time the mailcap file is parsed.

Table 8-2. Unix Argument Substitutions

Tag

Description

%s

Substitute a temporary filename.

%t

Substitute the Content-type.

%{<parameter>}

Substitute the named parameter to the Content-type.

Anytime a %s symbol is found in a program command line, it is replaced by the name of the temporary file generated. Suppose that we have some data with a Contenttype of image/jpeg. We get the data handler from the mailcap file, and ...

Get Programming Internet Email now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.