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 of the Berkeley Mail utility.
A simplified syntax with some commonly used options might include:
mailx [-s subject] [-c cc-addr] to-addr . . .
- subject of email (could be inserted later)
- 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.,
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).
$ mailx -s "From mailx" email@example.com type the body ... EOT (Ctrl+d) $
- 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
|This Unix-related article is a stub. You can help Wikipedia by expanding it.|