From Wikipedia, the free encyclopedia
Jump to: navigation, search

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]


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 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"
type the body
EOT (Ctrl+d)

See also[edit]


External links[edit]