LinuxCommandLibrary

compose

Define and run multi-container Docker applications

TLDR

Compose action can be used to compose any existing file or new on default mailcap edit tool

$ compose [filename]
copy

With run-mailcap
$ run-mailcap --action=compose [filename]
copy

SYNOPSIS

compose [options] [component [component ...]]

PARAMETERS

-h, --help
    Print help and exit

--usage
    Print brief usage summary

-V, --version
    Print version information

-v, --verbose
    Explain actions verbosely

--debug-level=LEVEL
    Set debugging level

--config-help
    Show configuration summary

--mail-rc=FILE
    Read config from FILE

--no-user-config
    Skip user config files

--no-site-config
    Skip site config files

-D, --define=NAME[=VALUE]
    Define macro NAME

-t, --to=ADDR
    Add To recipient

--cc=ADDR
    Add Cc recipient

--bcc=ADDR
    Add Bcc recipient

-s, --subject=TEXT
    Set Subject header

-F, --from=ADDR
    Set From address

-a, --attach=FILE
    Attach FILE

-R, --return-address=ADDR
    Set Return-Path

-E, --encoding=ENC
    Set default encoding

DESCRIPTION

The compose command from GNU Mailutils is an interactive tool for building complex MIME-compliant email messages. It provides a menu-driven interface to construct multipart messages, add text parts, attachments, images, and alternative content types. Users can edit headers like From, To, Subject, and Cc, as well as sign or encrypt with PGP/GnuPG.

Invoked standalone or by mail clients, it supports predefined components (e.g., text/plain, message/rfc822) and custom ones. Non-interactive mode allows scripting via command-line options for recipients, subjects, and attachments. Configuration draws from ~/.mailrc and site files, enabling customization of defaults like editor and MTA.

Ideal for advanced users needing structured emails beyond simple mail, it outputs to stdout for piping to sendmail or files. Handles MIME nesting, encodings (base64, quoted-printable), and dispositions (inline/attachment). Verbose and debug modes aid troubleshooting.

CAVEATS

Requires GNU Mailutils package; interactive mode needs terminal. Non-interactive use limited without components. Output must be piped to MTA like /usr/sbin/sendmail.

INTERACTIVE MODE

Run compose alone for menus: add parts (+), edit headers (h), send (s), quit (q).

COMPONENTS

Use text/plain, multipart/mixed, application/pdf; define custom in config.

EXAMPLE

echo 'Body' | compose -s 'Test' -t [email protected] --attach file.pdf | sendmail -t

HISTORY

Part of GNU Mailutils since 2001, developed by Sergey Poznyakoff. Evolved to support full MIME v2, PGP integration, and scripting.

SEE ALSO

mail(1), mime-construct(1), sendmail(8), mutt(1)

Copied to clipboard