Linux and Unix mailx command

Quick links

About mailx
Syntax
Examples
Related commands
Linux and Unix main page

About mailx

Mail interactive message processing system.

Syntax

mailx [-B] [-d] [-e] [-F] [-H] [-i] [-I] [-n] [-N] [-U] [-R] [-t] [-v] [-V] [-~] [-b bcc] [-c cc] [-h number][ -f [file | +folder ] ] [ -T file ] [ -u user ]

-BDo not buffer standard input or standard output.
-dTurn on debugging output. (Neither particularly interesting nor recommended.)
-eTest for the presence of mail. mailx prints nothing and exits with a successful return code if there is mail to read.
-FRecord the message in a file named after the first recipient. Overrides the record variable, if set.
-HPrint header summary only.
-iIgnore interrupts.
-IInclude the newsgroup and article-id header lines when printing mail messages. This option requires the -f option to be specified.
-m
-nDo not initialize from the system default mailx.rc or Mail.rc file.
-NDo not print initial header summary.
-UConvert UUCP-style addresses to Internet standards. Overrides the conv environment variable.
-R
-tScan the input for To:, Cc:, and Bcc: fields. Any recipients on the command line will be ignored.
-vPass the -v flag to sendmail.
-VPrint the mailx version number and exit.
-~Interpret tilde escapes in the input even if not reading from a tty.
-b bccSet the blind carbon copy list to bcc. bcc should be enclosed in quotes if it contains more than one name.
-c ccSet the carbon copy list to cc. cc should be enclosed in quotes if it contains more than one name.
-h numberThe number of network "hops" made so far. This is provided for network software to avoid infinite delivery loops. This option and its argument are passed to the delivery program.
-r addressUse address as the return address when invoking the delivery program. All tilde commands are disabled. This option and its argument is passed to the delivery program.
-s subjectSet the Subject header field to subject. subject should be enclosed in quotes if it contains embedded white space.
recipientThe recipient of the e-mail.
-f [file]Read messages from file instead of mailbox. If no file is specified, the mbox is used.
-f [+folder]Use the file folder in the folder directory (same as the fold er command). The name of this directory is listed in the folder variable.
-T fileMessage-id and article-id header lines are recorded in file after the message is read. This
option also sets the -I option.
-u userRead user's mailbox. This is only effective if user's mailbox is not read protected.

Examples

mailx support@computerhope.com

Start a new mail message to be sent to support at Computer Hope.

Related commands

biff
echo
ed
ex
fmt
lp
ls
mail
mailcompat
more
newaliases
pg
sh
vacation
vi