---
name: "mailcap.af"
section: "5"
platform: "linux"
package: "af"
version: "2.4.3-3"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/mailcap.af"
---

# mailcap.af(5)

MIME capabilities file, as used by af

## NAME

mailcap - MIME capabilities file, as used by af

## DESCRIPTION

The  *mailcap* file lists the known MIME content-types, and describes how to display, print, and compose each content-type.

Lines in the file which start with a '#' are treated as comments and ignored, as are blank lines.  Each other line contains a single mailcap entry.  Long entries may be continued onto the next line by ending them with a '\\'.

Each mailcap entry consists of at least a **content-type,** and a **command** to execute to display that content-type.  It may be followed by one or more optional fields, which give further information about how to handle the content-type.

The **content-type** may be any valid MIME content-type, in the form **type/subtype.** In addition, if no subtype is specified, or a '\*' is used as the subtype, then the content-type will match any subtype of the primary type.

The **command** may be any UNIX command, and is called to display messages of the given content-type.  All commands must follow the same rules, including those specfied in optional fields.

Any '\\' or ';' characters in a command string must be quoted with a strings:

- **%s**

  Is replaced by the name of a temporary file containing the message body.

- **%t**

  Is replaced by the content-type of the message, excluding any parameters. **%{"param"}** Is replaced by the value of the parameter named in *param,* or a blank string if no such parameter has been specified.

- **%n**

  Is replaced by the number of body parts if the message is a multipart message, or '0' otherwise.

- **%F**

  If the message is a multipart message, then this is replaced with a space-separated list of values, two for each body part.  The values give first the content-type of the body part, and then the name of a temporary file where it has been stored.

## Optional Fields

The optional fields, which can give more information about a content-type are:

- **test="command"**

  Describes a command which should be run successfully (ie. returning 0) before the mailcap entry is used.  The most common is "test -n $DISPLAY".

- **print="command"**

  Describes the command used to print the content-type.

- **edit="command"**

  Describes a command to edit a file containing the body of a message of the given content-type.

- **compose="command"**

  - **composetyped="command"**

  Describes a command to compose a file containing the body of a message of the given content-type.  Any command specified by the **composetyped** command, must also include a *Content-Type:* header in the output, which allows the composing command to add parameters to the content-type.

- **desc="text"**

  A textual description of the content-type.

- **file="template"**

  If any command includes the **%s** escape, then this field can specify a format for the filename. If **%s** appears in the template, then it will be replaced with characters to make the name unique.

- **needsterminal**

  **Indicates that the command is interactive, and needs control of** a terminal window to function.

- **copiousoutput**

  Indicates that the output of the command should be displayed via a pager.

- **textualnewlines**

  Forces af to treat newlines in the message body as it would for text, even though the content-type is not a subtype of text.

- **x11-bitmap="filename"**

  Names a file where a bitmap which can be used to mark this content-type is stored.  Not used by af.

## EXAMPLE

```
# A partial mailcap file
# Handle text/enriched and text/richtext
text/enriched; richtext -e; copiousoutput; \
description="Enriched text"
text/richtext; richtext; copiousoutput; \
description="Richtext"
# Display audio/basic using the audio device
audio/basic; cat > /dev/audio; \
description="An audio fragment"
# Handle PostScript files by printing them
# (this is a security hole)
application/postscript; lpr %s; \
description="A PostScript File"
```

## FILES

$HOME/.mailcap user's mailcap file

- /etc/af/mailcap

  global mailcap file for af.

- /etc/mailcap,

  - /usr/etc/mailcap,

  - /usr/local/etc/mailcap

  global mailcap files for all mailers.

## Author

Malc Arnold, based on a specification by Nathaniel Borenstein.

## SEE ALSO

[af(1)](/af/1.md), \`\`The Af Reference Manual'', rfc1524.
