Skip to main content

chainmail send

Send a new message from one account.

A send to recipients the policy does not allow is held: saved to Drafts, not sent, and the command exits 4.

The body is Markdown, sent as a text part and an HTML part, unless --text sends it as plain text. --body - reads it from stdin. --html-file sends an HTML file as the body, with --body as its text part when given.

Each --attach file is attached. Each --inline NAME=F shows the image F where the body refers to NAME, as in ![chart](chart.png) with --inline chart.png=./chart.png.

Running the same send again within 7 days reports the first send instead of sending twice: without --idempotency-key, the key is derived from the account, recipients, subject, body and files. To send identical content again on purpose, pass a new --idempotency-key.

--dry-run writes the message as MIME to stdout instead of sending it. It refuses a terminal unless --output json, which prints it as a JSON string.

Usage​

chainmail send [flags]

Examples​

chainmail send --account work --to [email protected] --subject "Lunch?" --body "Noon at the usual place?"
chainmail send --account work --to [email protected] --subject "Report" --body-file report.md --attach report.pdf
# a plain text body from stdin
echo "Done." | chainmail send --account work --to [email protected] --subject "Status" --body - --text
# see the MIME message without sending it
chainmail send --account work --to [email protected] --subject "Test" --body "hi" --dry-run > message.eml

Flags​

--account string the account to send from (required)
--attach stringArray attach this file (repeatable)
--bcc stringArray a blind-copied recipient, kept out of the message itself (repeatable)
--body string the body as Markdown, or - to read it from stdin
--body-file string read the Markdown body from this file
--cc stringArray a copied recipient (repeatable)
--draft save the message to Drafts instead of sending it
--dry-run write the message as MIME to stdout instead of sending it
--html-file string send this HTML file as the body, with --body as its text part when given
--idempotency-key string the key that stops a repeat from sending again (default: derived from the message)
--inline stringArray show image file F inline where the body refers to NAME, as NAME=F (repeatable)
--no-signature leave out the account's signature
--subject string the subject line (required)
--text send the body as plain text instead of Markdown
--to stringArray a recipient, "Name <a@b>" or "a@b" (repeatable)

Global flags​

--output string output format: json or table (default $CHAINMAIL_OUTPUT, then cli.toml, then table on a terminal, json otherwise)
--socket string daemon socket (default $CHAINMAIL_SOCKET, then cli.toml, then /run/chainmail/chainmail.sock)

See also​