mailx
enhanced mail command
TLDR
Send email
$ mailx -s "[Subject]" [recipient@example.com]
Send with body$ echo "[message]" | mailx -s "[Subject]" [recipient@example.com]
Send file$ mailx -s "[Subject]" [recipient@example.com] < [message.txt]
Send with attachment$ mailx -s "[Subject]" -a [file.pdf] [recipient@example.com]
Read mail$ mailx
Use SMTP server$ mailx -S smtp=[smtp://mail.example.com] -s "[Subject]" [recipient@example.com]
SYNOPSIS
mailx [options] [recipients]
DESCRIPTION
mailx is an enhanced mail command. It supports SMTP, attachments, and more features than basic mail.
The tool is POSIX-compatible with extensions. It handles both sending and reading email.
PARAMETERS
RECIPIENTS
Email addresses.-s SUBJECT
Email subject.-a FILE
Attach file.-c ADDR
CC recipients.-S VAR=VALUE
Set variable.-f FILE
Read from mailbox.--help
Display help information.
CAVEATS
Multiple implementations exist. SMTP config varies. May need s-nail or heirloom-mailx.
HISTORY
mailx evolved from the original Unix mail command, adding features like MIME support and SMTP.

