mail

sends and reads email

TLDR

Send email
$ mail -s "[Subject]" [[email protected]]
Send with body
$ echo "[message]" | mail -s "[Subject]" [[email protected]]
Send file contents
$ mail -s "[Subject]" [[email protected]] < [message.txt]
Send with attachment
$ mail -s "[Subject]" -A [file.pdf] [[email protected]]
Read mail
$ mail
Check specific mailbox
$ mail -f [/var/mail/user]

SYNOPSIS

mail [options] [recipients]

DESCRIPTION

mail sends and reads email. It's a basic command-line mail user agent.The tool can send quick emails from scripts. It reads mail from local mailboxes.

PARAMETERS

RECIPIENTS

Email addresses.
-s SUBJECT
Email subject.
-A FILE
Attach file.
-c ADDR
CC recipients.
-b ADDR
BCC recipients.
-f FILE
Read from mailbox.
--help
Display help information.

INSTALL

sudo apk add mailx
sudo zypper install mailx

CAVEATS

Requires MTA configured. Various implementations. May need mailutils package.

HISTORY

mail dates back to early Unix systems, providing basic email functionality for users and scripts.

SEE ALSO

mailx(1), sendmail(8), mutt(1)