LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

mailx

Enhanced mail command for sending and receiving Internet mail

TLDR

Send email (type body, end with Ctrl+D)
$ mailx -s "[Subject]" [recipient@example.com]
copy
Send with body from pipe
$ echo "[message]" | mailx -s "[Subject]" [recipient@example.com]
copy
Send from file
$ mailx -s "[Subject]" [recipient@example.com] < [message.txt]
copy
Send with attachment
$ mailx -s "[Subject]" -a [file.pdf] [recipient@example.com]
copy
Send with CC and BCC
$ mailx -s "[Subject]" -c [cc@example.com] -b [bcc@example.com] [recipient@example.com]
copy
Read mail
$ mailx
copy
Read mail from a specific mailbox file
$ mailx -f [path/to/mbox]
copy
Use SMTP server
$ mailx -S smtp=[smtp://mail.example.com] -s "[Subject]" [recipient@example.com]
copy

SYNOPSIS

mailx [options] [recipients]

DESCRIPTION

mailx is an enhanced mail command for sending and receiving Internet mail. It is POSIX-compatible with extensions for MIME support, SMTP connectivity, S/MIME, attachments, and more features than basic mail.It handles both sending and reading email. When called without arguments, it reads the user's mailbox. When given recipients, it enters compose mode.

PARAMETERS

RECIPIENTS

Email addresses.
-s SUBJECT
Email subject.
-a FILE
Attach file.
-c ADDR
CC recipients.
-b ADDR
BCC recipients.
-r ADDR
Set From address.
-S VAR=VALUE
Set internal variable (e.g., smtp, from, smtp-auth).
-t
Read recipients from To/Cc/Bcc headers in the message.
-f FILE
Read from mailbox file.
-N
Inhibit reading system-wide startup file.
-H
Print header summary and exit.
--help
Display help information.

INSTALL

sudo zypper install mailx
copy

CAVEATS

Multiple implementations exist (heirloom-mailx, s-nail, BSD mailx) with differing feature sets. SMTP configuration and attachment syntax varies between implementations. The -a flag means "attach file" in heirloom-mailx/s-nail but "set header" in BSD mailx.

HISTORY

mailx evolved from the original Unix mail command through Berkeley Mail. Modern implementations include s-nail (successor to heirloom-mailx) which adds MIME, SMTP, POP3, and IMAP support.

SEE ALSO

mail(1), mutt(1), sendmail(8)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid