runmailcap
Execute commands based on MIME type
SYNOPSIS
runmailcap [-d] [-p] [-v] [-t content-type] [-f mailcapfile] file
PARAMETERS
-d
Debug mode. Displays verbose debugging information during execution.
-p
Print the selected command to standard output instead of executing it.
-v
Verbosely describe what runmailcap is doing.
-t content-type
Specify the content-type to search for in the mailcap files. If not specified, runmailcap tries to guess the content-type from the file extension.
-f mailcapfile
Specify a particular mailcap file to use. Overrides the MAILCAPS environment variable.
file
The file to process. The content-type is determined from the mailcap file, and is based upon the filename.
DESCRIPTION
runmailcap executes commands specified in mailcap files based on the content-type provided.
Mailcap files are used to associate MIME types with actions, typically viewing or editing.
runmailcap reads the MAILCAPS environment variable to find a list of mailcap files. If MAILCAPS is not set, it defaults to /etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap:~/.mailcap.
It searches these files for an entry matching the specified content-type, and if a suitable entry is found, executes the command associated with it.
This command is useful for automating the handling of different file types based on their MIME type within scripts or other applications. It essentially provides a mechanism for 'opening' files in a content-aware manner. Command may need a properly configured `mailcap` file to work, and correct access to the commands described in the `mailcap` file.
CAVEATS
The effectiveness of runmailcap depends heavily on the accuracy and completeness of the mailcap files. Security vulnerabilities could arise if mailcap entries execute arbitrary code. Content-type guessing based on file extensions is not always reliable.
MAILCAP FILE FORMAT
Mailcap files contain entries that define actions for specific MIME types. Each entry typically includes the MIME type, a command to execute, and optional flags or parameters. These files are crucial for the proper functioning of runmailcap.
ENVIRONMENT VARIABLES
MAILCAPS: Specifies a colon-separated list of mailcap files to search. If this variable is not set, runmailcap uses the default list (/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap:~/.mailcap).
SEE ALSO
mailcap(4), mimeopen(1)