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 ]

-B Do not buffer standard input or standard output.
-d Turn on debugging output. (Neither particularly interesting nor recommended.)
-e Test for the presence of mail. mailx prints nothing and exits with a successful return code if there is mail to read.
-F Record the message in a file named after the first recipient. Overrides the record variable, if set.
-H Print header summary only.
-i Ignore interrupts.
-I Include the newsgroup and article-id header lines when printing mail messages. This option requires the -f option to be specified.
-m
-n Do not initialize from the system default mailx.rc or Mail.rc file.
-N Do not print initial header summary.
-U Convert UUCP-style addresses to Internet standards. Overrides the conv environment variable.
-R
-t Scan the input for To:, Cc:, and Bcc: fields. Any recipients on the command line will be ignored.
-v Pass the -v flag to sendmail.
-V Print the mailx version number and exit.
-~ Interpret tilde escapes in the input even if not reading from a tty.
-b bcc Set the blind carbon copy list to bcc. bcc should be enclosed in quotes if it contains more than one name.
-c cc Set the carbon copy list to cc. cc should be enclosed in quotes if it contains more than one name.
-h number The 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 address Use 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 subject Set the Subject header field to subject. subject should be enclosed in quotes if it contains embedded white space.
recipient The 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 file Message-id and article-id header lines are recorded in file after the message is read. This
option also sets the -I option.
-u user Read 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