run-mailcap
Execute command specified in mailcap file
TLDR
Individual actions/programs on run-mailcap can be invoked with action flag
In simple language
Turn on extra information
Ignore any "copiousoutput" directive and forward output to stdout
Display the found command without actually executing it
SYNOPSIS
run-mailcap [options] file
PARAMETERS
-p
Print the command that would be executed, without actually executing it.
-t
Don't try to open a terminal window; simply run the command in the background.
-n
Execute the command even if no DISPLAY is available.
-v
Verbose output. Display diagnostic messages.
file
The file to be processed. The mailcap entry will be determined based on the file's MIME type.
DESCRIPTION
The `run-mailcap` command is a utility that executes commands specified in mailcap (mail capability) files. Mailcap files define how different MIME types should be handled, instructing the system which applications to use for displaying, editing, or otherwise processing files based on their content type. `run-mailcap` reads the mailcap files, identifies the appropriate entry for a given MIME type, and then executes the associated command. This is often used to automatically open or process files attached to emails or accessed through web browsers. It provides a standardized mechanism for handling diverse data formats across different platforms, ensuring a consistent user experience. The command uses the `$DISPLAY` environment variable to associate itself with the GUI. Command execution involves shell interpretation and potentially handling standard input/output redirection.
CAVEATS
The command relies on correctly configured mailcap files. If the mailcap configuration is incorrect or incomplete, the command may fail or execute unintended actions. It's also vulnerable to shell injection if mailcap entries contain unsanitized user input. Requires a working `mailcap` configuration.
MAILCAP FILES
Mailcap files (typically located in `/etc/mailcap`, `~/.mailcap`, and other system-specific locations) contain entries that map MIME types to commands. Each entry specifies the MIME type, the command to execute, and optional flags or parameters. The format is described in the mailcap(4) manual page. The `run-mailcap` command consults these files to determine the appropriate action for a given file.
MIME TYPE DETECTION
Before executing any command, `run-mailcap` needs to determine the MIME type of the input file. It commonly relies on tools like `file` (using the magic number database) or extensions. The command must be able to correctly determine the MIME type to find the correct rule in the mailcap database.
SEE ALSO
mailcap(4)