Synopsis
perch mail send [OPTIONS]Description
Compose a MIME message and submit it through SMTP. Text and HTML bodies are combined as multipart/alternative; attachments wrap the result in multipart/mixed.
Bodies come from –body/–body-file and –html-body/–html-file, or stdin when it is not a terminal. Attachments are base64 encoded and content types are detected from the file extension or contents.
Notes
- Bodies are quoted-printable unless –8bitmime is set; attachments are base64.
- SMTPUTF8 is detected from non-ASCII envelope addresses and extra headers; force it with –smtputf8.
- Bcc recipients are envelope-only and never appear in headers.
- SIZE is sent automatically and checked against the server’s advertised limit.
Options
| Option | Description |
|---|---|
--username, -u <value> | account username (env PERCH_IMAP_USER) |
--password <value> | account password (prefer PERCH_IMAP_PASSWORD or –password-file) |
--password-file <value> | read the account password from a file |
--password-stdin | read the account password from stdin |
--timeout <value> | connection timeout (default: 30s) |
--config <value> | configuration file (default: ~/.config/perch/perch.yaml) |
--from <value> | sender address (default: –username) |
--to <value>... | recipient address or list; repeatable |
--cc <value>... | Cc recipient address or list; repeatable |
--bcc <value>... | Bcc recipient address or list; repeatable |
--reply-to <value>... | Reply-To address or list; repeatable |
--subject, -s <value> | message subject |
--body <value> | plain-text body |
--body-file <value> | read the plain-text body from a file (use - for stdin) |
--html-body <value> | HTML body |
--html-file <value> | read the HTML body from a file (use - for stdin) |
--attach, -a <value>... | attach a file; repeatable |
--header, -H <value>... | add an extra header (Name: Value); repeatable |
--in-reply-to <value> | Message-ID being replied to |
--references <value> | space-separated Message-IDs for References |
--8bitmime | send UTF-8 text with BODY=8BITMIME |
--smtputf8 | force SMTPUTF8 (usually detected automatically) |
--dry-run, -n | write the composed message to stdout without sending |
--verbose, -v | print SMTP capabilities and delivery details to stderr |
--smtp-server, -S <value> | SMTP submission server (smtps://host, smtp://host, or host[:port]); defaults from –config |
--smtp-plaintext | connect to SMTP without TLS (use only on trusted networks) |
--smtp-starttls | require STARTTLS for SMTP |
--smtp-implicit-tls | use implicit TLS for SMTP (usually port 465) |
--smtp-insecure | skip SMTP TLS certificate verification |
--smtp-ca-file <value> | PEM CA bundle used to verify the SMTP server certificate |
--help, -h | show help |
Examples
perch mail send --from you@example.com --to alice@example.com \
--subject Hello --body 'Hi Alice'
echo 'Body from stdin' | perch mail send --from you@example.com \
--to alice@example.com --subject Hello
perch mail send --from you@example.com --to alice@example.com \
--subject Report --body-file message.txt --html-file message.html \
--attach report.pdf
perch mail send ... --dry-run > message.emlEnvironment
| Variable | Purpose |
|---|---|
PERCH_IMAP_USER | default account username and sender |
PERCH_IMAP_PASSWORD | account password |