Jump to content

mailx

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by JJMC89 (talk | contribs) at 07:09, 6 February 2016 (WP:FIX + general fixes, typo(s) fixed: by by → by using AWB). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.


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" abc@cde.com
type the body
...
EOT (Ctrl+d)
$

See also

References