Synopsis

perch mail [OPTIONS] COMMAND

Description

The mail command group is a scriptable IMAP and SMTP client. list, search, and fetch talk IMAP; send talks SMTP; caps prints the SMTP EHLO extensions of a submission server.

Credentials and TLS flags are shared. IMAP flags are local to list/search/fetch; SMTP flags are local to send/caps.

Notes

  • If –server or –smtp-server is omitted, the matching listener is taken from –config.
  • Use –plaintext or –smtp-plaintext only for trusted loopback listeners.
  • Password sources: –password-file, –password-stdin, PERCH_IMAP_PASSWORD, or an interactive prompt.

Options

OptionDescription
--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-stdinread the account password from stdin
--timeout <value>connection timeout (default: 30s)
--config <value>configuration file (default: ~/.config/perch/perch.yaml)
--help, -hshow help

Commands

CommandDescription
perch mail listlist mailboxes
perch mail searchsearch message metadata
perch mail fetchfetch raw messages
perch mail sendcompose and send a message
perch mail capsshow the SMTP extensions advertised by a submission server

Examples

perch mail list --server imaps://mail.example.com --username you@example.com

perch mail search -q 'unseen from:alice' --json

perch mail fetch -q 'from:alice' --format mbox > alice.mbox

perch mail send --from you@example.com --to alice@example.com \
  --subject Hello --body 'Hi Alice'

Environment

VariablePurpose
PERCH_IMAP_USERdefault account username
PERCH_IMAP_PASSWORDaccount password

See also