mailx
mailx is a Unix utility program for sending and receiving mail, also known as a Mail User Agent program. Being a console application with a command syntax similar to ed, it is the POSIX standardized variant[1] of the Berkeley Mail utility.[2]
Usage
A simplified syntax with some commonly used options might include:
mailx [-s subject] [-c cc-addr] to-addr . . .
- -s
- subject of email (could be inserted later)
- -c
- send carbon copies to a user or users
The end of message is indicated by hitting ctrl+d (and/or, dependent on the configuration settings, by writing a line consisting of a single '.'), causing the message to be passed asynchronously to the Mail transport agent. In order to send messages synchronously the mailx
internal, POSIX-standardized variable sendwait has to be set, usually in the system-wide initialization file (usually /etc/mail.rc); dependent on the used mailx
variant the (nonstandard) command-line option -S
can also be used, e.g., mailx -Ssendwait
.
By default, users compose messages in mailx
line by line, without the use of a text editor. The user may issue a command to mailx
by entering a line that begins with a tilde (~). The ~v command causes mailx
to invoke a text editor (defined by the VISUAL environment variable) on the message in progress, saved in a temporary file, and likewise for ~e (using the EDITOR environment variable).
Example usage:
$ mailx -s "From mailx" [email protected]
type the body
...
EOT (Ctrl+d)
$
See also
References
External links
- POSIX standard entry
- History of mail and mailx from the Heirloom Project
- mailx Tutorial from the engineering Dpt. at Purdue University
- mail at GNU Mailutils manual
- S-nail mailx(1)manual