Code:
MAILX(1) User Commands MAILX(1)
NAME
mailx - send and receive Internet mail
SYNOPSIS
mailx [-BDdEFintv~] [-s subject] [-a attachment ] [-c cc-addr] [-b bcc-
addr] [-r from-addr] [-h hops] [-A account] [-S vari-
able[=value]] to-addr . . .
mailx [-BDdeEHiInNRv~] [-T name] [-A account] [-S variable[=value]] -f
[name]
mailx [-BDdeEinNRv~] [-A account] [-S variable[=value]] [-u user]
DESCRIPTION
Mailx is an intelligent mail processing system, which has a command
syntax reminiscent of ed(1) with lines replaced by messages. It is
based on Berkeley Mail 8.1, is intended to provide the functionality of
the POSIX mailx command, and offers extensions for MIME, IMAP, POP3,
SMTP, and S/MIME. Mailx provides enhanced features for interactive
use, such as caching and disconnected operation for IMAP, message
threading, scoring, and filtering. It is also usable as a mail batch
language, both for sending and receiving mail.
The following options are accepted:
-A name
Executes an account command (see below) for name after the
startup files have been read.
-a file
Attach the given file to the message.
-B Make standard input and standard output line-buffered.
-b address
Send blind carbon copies to list. List should be a comma-sepa-
rated list of names.
-c address
Send carbon copies to list of users.
-D Start in disconnected mode; see the description for the discon-
nected variable option.
-d Enables debugging messages and disables the actual delivery of
messages. Unlike -v, this option is intended for mailx develop-
ment only.
-e Just check if mail is present in the system mailbox. If yes,
return an exit status of zero, else, a non-zero value.
-E If an outgoing message does not contain any text in its first or
only message part, do not send it but discard it silently,
effectively setting the skipemptybody variable at program
startup. This is useful for sending messages from scripts
started by cron(8).
-f [file]
Read in the contents of the userâs mbox (or the specified file)
for processing; when mailx is quit, it writes undeleted messages
back to this file. The string file is handled as described for
the folder command below.
-F Save the message to send in a file named after the local part of
the first recipientâs address.
-H Print header summaries for all messages and exit.
-h hops
Invoke sendmail with the specified hop count. This option has
no effect when SMTP is used for sending mail.
-i Ignore tty interrupt signals. This is particularly useful when
using mailx on noisy phone lines.
-I Shows the âNewsgroup:â or âArticle-Id:â fields in the header
summary. Only applicable in combination with -f.
-n Inhibits reading /etc/mail.rc upon startup. This option should
be activated for mailx scripts that are invoked on more than one
machine, because the contents of that file may differ between
them.
-N Inhibits the initial display of message headers when reading
mail or editing a mail folder.
-q file
Start the message with the contents of the specified file. May
be given in send mode only.
-r address
Sets the From address. Overrides any from variable specified in
environment or startup files. Tilde escapes are disabled. The
-r address options are passed to the mail transfer agent unless
SMTP is used. This option exists for compatibility only; it is
recommended to set the from variable directly instead.
-R Opens any folders read-only.
-s subject
Specify subject on command line (only the first argument after
the -s flag is used as a subject; be careful to quote subjects
containing spaces).
-S variable[=value]
Sets the internal option variable and, in case of a string
option, assigns value to it.
-T name
Writes the âMessage-Id:â and âArticle-Id:â header fields of each
message read in the file name. Implies -I. Compressed files
are handled as described for the folder command below.
-t The message to be sent is expected to contain a message header
with âTo:â, âCc:â, or âBcc:â fields giving its recipients.
Recipients specified on the command line are ignored.
-u user
Reads the mailbox of the given user name.
-v Verbose mode. The details of delivery are displayed on the
userâs terminal.
-V Print mailxâs version and exit.
-~ Enable tilde escapes even if not in interactive mode.
Sending mail
To send a message to one or more people, mailx can be invoked with
arguments which are the names of people to whom the mail will be sent.
The user is then expected to type in his message, followed by an âcon-
trol-Dâ at the beginning of a line. The section below Replying to or
originating mail, describes some features of mailx available to help
when composing letters.
Reading mail
In normal usage mailx is given no arguments and checks the userâs mail
out of the post office, then prints out a one line header of each mes-
sage found. The current message is initially the first message (num-
bered 1) and can be printed using the print command which can be abbre-
viated âpâ). The user can move among the messages much as he moves
between lines in ed(1), with the commands â+â and â-â moving backwards
and forwards, and simple numbers.
Disposing of mail
After examining a message the user can delete âdâ) the message or reply
ârâ) to it. Deletion causes the mailx program to forget about the mes-
sage. This is not irreversible; the message can be undeleted âuâ) by
giving its number, or the mailx session can be aborted by giving the
exit âxâ) command. Deleted messages will, however, usually disappear
never to be seen again.
Specifying messages
Commands such as print and delete can be given a list of message num-
bers as arguments to apply to a number of messages at once. Thus
âdelete 1 2â deletes messages 1 and 2, while âdelete 1-5â deletes mes-
sages 1 through 5. In sorted or threaded mode (see the sort and thread
commands), âdelete 1-5â deletes the messages that are located between
(and including) messages 1 through 5 in the sorted/threaded order, as
shown in the header summary. The following special message names
exist:
:n All new messages.
:o All old messages (any not in state read or new).
:u All unread messages.
:d All deleted messages (for the undelete command).
:r All read messages.
:f All âflaggedâ messages.
:a All answered messages (cf. the markanswered variable).
:t All messages marked as draft.
:k All âkilledâ messages.
:j All messages classified as junk.
. The current message.
; The message that was previously the current message.
, The parent message of the current message, that is the message
with the Message-ID given in the âIn-Reply-To:â field or the
last entry of the âReferences:â field of the current message.
- The next previous undeleted message, or the next previous
deleted message for the undelete command. In sorted/threaded
mode, the next previous such message in the sorted/threaded
order.
+ The next undeleted message, or the next deleted message for the
undelete command. In sorted/threaded mode, the next such mes-
sage in the sorted/threaded order.
^ The first undeleted message, or the first deleted message for
the undelete command. In sorted/threaded mode, the first such
message in the sorted/threaded order.
$ The last message. In sorted/threaded mode, the last message in
the sorted/threaded order.
&x In threaded mode, selects the message addressed with x, where x
is any other message specification, and all messages from the
thread that begins at it. Otherwise, it is identical to x. If
x is omitted, the thread beginning with the current message is
selected.
* All messages.
â All messages that were included in the message list for the pre-
vious command.
-- is this what you are saying
MIME types
For any outgoing attachment, mailx tries to determine the content type. It does this by reading MIME type files
whose lines have the following syntax:
type/subtype extension [extension . . .]
where type/subtype are strings describing the file contents, and extension is the part of a filename starting after
the last dot. Any line not immediately beginning with an ASCII alphabetical character is ignored by mailx. If
there is a match with the extension of the file to attach, the given type/subtype pair is used. Otherwise, or if
the filename has no extension, the content types text/plain or application/octet-stream are used, the first for text
or international text files, the second for any file that contains formatting characters other than newlines and
horizontal tabulators.
Character sets
Mailx normally detects the character set of the terminal using the LC_CTYPE locale setting. If the locale cannot be
used appropriately, the ttycharset variable should be set to provide an explicit value. When reading messages,
their text is converted to the terminal character set if possible. Unprintable characters and illegal byte
sequences are detected and replaced by Unicode substitute characters or question marks unless the print-all-chars is
set at initialization time.
The character set for outgoing messages is not necessarily the same as the one used on the terminal. If an outgoing
text message contains characters not representable in US-ASCII, the character set being used must be declared within
its header. Permissible values can be declared using the sendcharsets variable, separated by commas; mailx tries
each of the values in order and uses the first appropriate one. If the message contains characters that cannot be
represented in any of the given character sets, the message will not be sent, and its text will be saved to the
âdead.letterâ file. Messages that contain NUL bytes are not converted.
Outgoing attachments are converted if they are plain text. If the sendcharsets variable contains more than one
character set name, the ~@ tilde escape will ask for the character sets for individual attachments if it is invoked
without arguments.
Best results are usually achieved when mailx is run in a UTF-8 locale on a UTF-8 capable terminal. In this setup,
characters from various countries can be displayed, while it is still possible to use more simple character sets for
sending to retain maximum compatibility with older mail clients.