mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
NAME
mailx -- read electronic mail
SYNOPSIS
mailx [-efHiNn] [-u user] [filename]
mailx [-FinU] [-h number] [-r address] [-s subject] user ...
DESCRIPTION
mailx helps you read and send electronic mail messages. It has
no built-in facilities for sending messages to other systems, but
combined with other programs (a mail routing agent, and a trans-
port agent), it can send messages to other systems.
The command line
mailx [options] user user user ...
sends a mail message to the given users. If you do not specify
any users on the command line, mailx lets you read incoming mail
interactively.
Options
mailx accepts the following options when you are reading mes-
sages:
-e checks to see if you have any messages waiting to be read.
With this option, nothing is displayed. If you have waiting
messages, mailx exits with a successful status return;
otherwise, mailx exits with a failure return.
-f looks for messages in the file given by the optional
filename on the command line instead of in your system mail-
box. If you do not specify filename, mailx reads messages
from ~/mbox.
-H displays only the header summary of a message.
-N does not display the header summary of messages.
-u user
looks for messages in the system mailbox of the specified
user. This only works if you have read permission on the
user's system mailbox.
mailx accepts the following options only when you are sending
messages:
-F records your message in a file with the same name as the
first user specified on the command line. This option over-
rides the record variable, if it has been set. See the
ENVIRONMENT VARIABLES section for more on the record vari-
able.
1
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
-h number
indicates how many hops a message has already made from one
machine to another (in a network of machines). This option
is not intended for most users; some network mail software
uses the option to prevent infinite loops (the same message
cycling through a sequence of machines without ever getting
to its intended destination).
-r address
passes the given address to network mail software. If this
option is present, it disables all input mode commands.
-s subject
uses the given subject string in the Subject heading line of
the message. If the subject contains spaces or TAB charac-
ters, the string should be enclosed in double quotes (" ")
or apostrophes (' '). If you specify this option on the
command line, mailx does not prompt you to enter a Subject
line when you type in the text of the message.
-U converts the address from UUCP style to internet standards.
This overrides the effect of the conv environment variable.
See the ENVIRONMENT VARIABLES section for more information.
mailx accepts the following options when you are sending or read-
ing messages:
-i ignores interrupts (for example, pressing BREAK or CTRL-C).
Also see the description of the ignore environment variable
in the section on ENVIRONMENT VARIABLES.
-n does not initialize your mailx session from the system's
/etc/mailx.rc file. For more information about this file,
see the Start-Up Files section.
General Overview
This section describes the default behavior of mailx. You can
use mailx in many ways, and these are discussed later; however,
you must first understand mailxs normal pattern of behavior.
The simplest command to send a message is
mailx address address address ...
where each address names someone who is to receive the message.
The simplest kind of address is the login name of someone else
who uses your machine. You can also use network addresses here,
but mailx itself cannot send messages over a network; it requires
some sort of network server. MPE/iX Shell and Utilities does not
include server software.
You can also send messages as input to commands. To do this, use
2
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
an address that consists of an or-bar (|) followed by a command
line that invokes the appropriate command. Enclose this whole
address in apostrophes. For example,
mail robin '|cat >save'
mails a message to robin and also copies the message into a file
called save.
After you type in the command to send a message, mailx asks you
to enter the Subject of the message (a brief description of what
the message is about). You can now type in the text of your mes-
sage. Your message can consist of any number of lines, and may
include blank lines. When you finish entering the message, type
a line consisting only of a tilde (~), followed by a dot (.);
then press ENTER. This tells mailx that the message is ready to
be sent.
mailx puts the completed message into a file called the recipi-
ent's system mailbox. The message stays there until the recipient
asks. At that point, the message is obtained from the system
mailbox and displayed on the recipient's terminal. It is then
saved in the recipient's personal mailbox. Since this is usually
a file named mbox under the recipient's home directory, mbox rep-
resents the personal mailbox and mailbox represents the system
mailbox.
The simplest way to read incoming messages is to type the command
mailx (with no addresses on the command line). This starts an
interactive session in which mailx lets you read your mail and
perform other operations. For example, you can display new mes-
sages, delete old ones, reply to messages or forward them to
someone else, and so on. When you are performing operations in
this way, you are in command mode. When you are typing in the
text of a message, you are in input mode.
A message consists of a sequence of header lines followed by the
body of the message. The header lines tell who sent the message,
the time and date that it was sent, its subject, and so on.
mailx automatically creates header lines. Some of the common
header lines are:
Cc: name name ...
Stands for carbon copies. This indicates that copies of
this message are to be sent to the specified recipients.
The names of these recipients appear in the header lines of
everyone receiving the message.
Bcc: name name ...
Stands for blind carbon copies. This is similar to Cc: but
the names of people receiving carbon copies do not appear in
the header lines of the message. Recipients do not know
that these people received a copy of the message.
3
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
Subject: text
Gives the subject of the message.
To: name name ...
Gives the names of people who were sent the message
directly.
All messages are in one of the following states:
deleted
You used a delete, dp, or dt command to delete the message,
or you saved it using a Save or save command and the vari-
able keepsave was not set. When mailx quits, it deletes mes-
sages in this state.
new The message is in the system mailbox and you have not yet
read it or otherwise changed its state. When mailx quits,
it retains messages in this state in your system mailbox.
preserved
You used a preserve command on the message. When mailx
quits, it retains messages in this state in their current
locations.
read You used one of the following commands on the message:
~F ~m next print type
~f copy pipe top undelete
~M mbox Print Type
or you used delete, dp, or dt on the preceding message and
the autoprint environment variable was set. When mailx
quits and you are in your system mailbox, it saves read mes-
sages in your personal mailbox unless the variable hold is
set, in which case, it retains them in your system mailbox.
If you are in your personal or a secondary mailbox when
mailx quits, it retains read messages in their current loca-
tion.
unread
You have run more than one mailx session with the message in
the system mailbox and you have not read it or otherwise
changed its state. When mailx quits, it retains messages in
this state in your system mailbox.
Command Mode Commands
The format of a command mode command is
[command][refs][arguments]
If no command is specified, p[rint] is assumed.
4
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
The refs argument indicates the messages to which you want to
apply the command. mailx numbers incoming messages sequentially
as they are received. The easiest way to refer to a message is
to give its number. For example, the command
p 3
displays message number 3. At any point in a mailx session,
there is one message that is considered the current message.
Loosely speaking, this is the message you most recently used in a
command (for example, the one you most recently read). If you
omit the refs argument in a command that uses refs, the command
works with the current message. You can also use special nota-
tions as the refs value, as in Table 1, Reference Notations.
_________________________________________________________
| Ref Meaning |
|________________________________________________________|
| n Message number n |
| n-m Messages n through m |
| . The current message |
| ^ The first undeleted message |
| (or first deleted message for undelete) |
| $ The last message |
| * All messages |
| + Next message |
| - Previous message |
| user All messages from the given user |
| /string All messages with string in the subject line |
| (the case of characters in string is ignored) |
| :d All deleted messages |
| :n All new messages |
| :o All old messages |
| :r All messages that have already been read |
| :u All unread messages |
|________________________________________________________|
Table 1: Reference Notations
Several refs may be specified for the same command, separated by
spaces. For example,
p alice lewis
displays all messages from alice plus all messages from lewis.
The arguments allowed at the end of a command mode command depend
on the command itself. If a command allows a file name as an
argument, the usual file name generation characters may be used
in the file name. See sh(1).
The following list shows the commands recognized in command mode.
In every command name, some characters are enclosed in square
5
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
brackets. These characters are optional. For example, the
p[rint] command may be given as print or p.
a[lias] [alias [name ...]]
sets up an address alias. If you issue a command to send
mail to the given alias, the messages are actually sent to
the given list of names. For example, you might issue the
command
alias joe jsmith
From this point onward, you can address messages to joe and
they are sent to jsmith. You may also set up an alias for
several people, as in
alias choir soprano alto tenor bass
Once you have done this, you can send messages to choir and
they are sent to the names that follow choir in the command.
Issuing the alias command without any arguments displays a
list of the currently defined aliases.
Note: Aliases which are entered interactively remain in
effect only until the end of the current interactive ses-
sion. To make an alias permanent, include the alias command
in your start-up file (see Start-Up Files). See also group.
alt[ernates] name ...
lists a set of alternate names for your own login name.
This is useful for people who login under several different
names. When you reply to a message, mailx usually sends
your reply to the author of the message and all the recipi-
ents as well; however, it does not send the message to any
of your alternate login names. In this way, you don't have
to worry about sending mail to yourself.
Specifying alternates without names displays your list of
currently defined alternate names.
cd directory
makes directory your new working directory. If no directory
is specified, cd goes to your HOME directory.
ch[dir] directory
is the same as cd.
c[opy] [filename]
copies the current message into the specified file. If the
file does not already exist, it is created. If no filename
is specified, your mbox file is used.
This operation does not mark the message as saved; if it was
previously unread, it is still regarded as an unread mes-
sage. Thus the original message remains in your system
mailbox. See also save.
6
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
c[opy] refs filename
copies the messages referenced by refs into the given file.
The filename must be specified. If the file does not
already exist, it is created. As with the previous form of
copy, the messages are not marked as saved.
C[opy] [refs]
is similar to the copy command, except that the referenced
messages are saved in a file the name of which is derived
from the author of the first message referenced. The name
of the file is the author's name, stripped of any network
addressing. If the folder variable is set, the file is saved
to the specified directory. The copied messages are not
marked as saved. If no refs are specified, the current mes-
sage is copied.
d[elete] [refs]
deletes the specified messages. If no refs are specified,
the current message is deleted. After a delete operation,
the current message is set to the message after the last
message deleted. Deleted messages are not thrown away until
you end your session with the current mailbox (see quit,
file). Until then, they can be undeleted (see undelete).
di[scard] [header ...]
does not display the given header fields when displaying a
message. For example,
discard References
tells mailx not to display the References line at the begin-
ning of any mail message. These header lines are retained
when the message is saved; they are just not shown when the
message is displayed. See also ignore and retain.
dp [refs]
deletes the specified messages, then displays the message
after the last message deleted. If there is no subsequent
message, mailx displays its command prompt.
dt [refs]
is the same as the dp command.
ec[ho] string ...
echoes the given strings (like the echo(1) command).
e[dit] [refs]
lets you edit the messages specified by refs. The messages
are stored in a temporary file and an editor is invoked to
let you edit the file. The default editor is ed(1), but you
can change this using the EDITOR environment variable (see
the ENVIRONMENT VARIABLES section).
7
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
ex[it]
quits mailx without changing the system mailbox. Contrast
this with quit.
fi[le] [filename]
quits the current mailbox (as if a q[uit] command was exe-
cuted), then reads in the specified file as the new mailbox
to examine. If no filename is specified, mailx displays the
name and status of your current mailbox.
Several special strings can be used in place of filename:
% your system mailbox
%user the system mailbox for user
# the previous file
& your mbox
+file the named file in the folder directory
fold[er] [filename]
is the same as the file command.
folders
displays the names of the files in the directory given by
the folder variable; see the ENVIRONMENT VARIABLES section.
F[ollowup] [refs]
replies to the first message given in the refs; mailx sends
this reply to the authors of every message given in the
refs. The Subject line is taken from the first message in
the refs. mailx automatically saves your reply in a file
which derives its name from the author of the message to
which you are replying.
To create your reply, mailx puts you into input mode, where
you can use all of the input mode commands.
fo[llowup] [ref]
replies to the specified message; if no message ref is
given, you reply to the current message. mailx automati-
cally saves your reply in a file which derives its name from
the author of the original message. This overrides the
record environment variable if it is set; see the ENVIRON-
MENT VARIABLES section.
To create your reply, mailx puts you into input mode, where
you can use all of the input mode commands.
f[rom] [refs]
displays the header summary for the specified messages. If
no refs are given, the current message is used.
g[roup] [alias [name ...]]
is the same as the alias command.
8
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
h[eaders] [ref]
displays the headers of a screenful of messages including
the message given by ref. The number of lines in a screen is
given by the screen environment variable; see the ENVIRON-
MENT VARIABLES section.
hel[p]
displays a summary of the command mode commands.
ho[ld] [refs]
retains the specified messages in your system mailbox. For
example, you might decide to hold a message if you read it,
but decide not to act upon it immediately. If no refs are
specified, the current message is held. If any of the
specified messages have been marked as deleted, the hold
command overrides that and still retains the messages. Sub-
sequent delete, dp, and dt commands during the same mailx
session can delete files marked for retention. See also
preserve, and the environment variables hold and keepsave.
i[f] code
mailx commands
[el[se]
mailx commands]
en[dif]
is primarily intended for use in start-up files; see the
Start-Up Files section for information. The code must be
the character r or s. If it is r, the first set of mailx
commands are executed if mailx is in receive mode, and the
second set if mailx is in send mode. If code is s, the oppo-
site is true. The else part is optional.
ig[nore] [header ...]
is the same as the discard command.
l[ist]
displays the names of all command mode commands.
m[ail] address ...
sends a message to the specified recipients. mailx goes
into input mode to let you enter the text of the message.
mb[ox] [refs]
indicates that the given messages are to be saved in your
mbox when mailx quits normally (that is, through the quit
command as opposed to exit).
n[ext] [refs]
goes to the next message in the mailbox that appears in the
list of refs. For example,
n user
9
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
goes to the next message from the specified user.
pi[pe] [[refs] command]
pipes the messages given by refs through the specified shell
command (run by the command interpreter identified by SHELL)
These messages are considered read. If no refs are given,
the current message is used. If no command is given, mailx
uses the command given by the cmd environment variable; see
the ENVIRONMENT VARIABLE section. If the page variable has
a value, a formfeed is sent into the pipe after every mes-
sage. The command
| [refs] [command]
is equivalent to pipe.
pre[serve] [refs]
is the same as the hold command.
P[rint] [refs]
displays the specified messages on the screen. If no refs
are given, the current message is displayed. All header
fields are displayed; the discard and ignore commands do not
affect Print.
p[rint] [refs]
displays the specified messages on the screen. If no refs
are given the current message is displayed. Header fields
specified by discard and ignore commands are not displayed.
If the crt variable is set to an integer, messages with more
lines than that integer are paginated using the command
specified by the PAGER variable. For more information, see
the ENVIRONMENT VARIABLES section.
q[uit]
terminates a mailx session. This is the usual method to
leave mailx. Messages that have been read but not saved or
deleted are stored in your mbox. Messages that are still
unread are retained in your system mailbox. Messages that
have been deleted or explicitly saved in other files are
discarded. Typing the EOF character has the same effect.
R[eply] [refs]
sends a reply to the authors of each of the messages speci-
fied by refs. If no refs are specified, the current message
is used. The Subject line of the reply message is taken
from the first message in refs. If the record environment
variable is set to a file name, your reply message is
appended to the end of that file.
Normally, you use Reply if you just want to send your reply
to the author of a message, and reply if you want to send
your reply to the author and all recipients. If set, the
10
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
flipr variable reverses the meanings of the R and r com-
mands. See the ENVIRONMENT VARIABLES section.
r[eply] [ref]
sends a reply to the author of a specific message, and all
other recipients of the message. If no ref is specified,
mailx replies to the current message. If the record envi-
ronment variable is set to a file name, your reply message
is appended to the end of that file.
R[espond] [refs]
is the same as the Reply command.
r[espond] [ref]
is the same as the reply command.
ret[ain] [header ...]
is the opposite of the discard command. It tells mailx to
display the given header fields when displaying a message.
The comparison of header fields is not case sensitive. You
can use retain to override existing discard and ignore com-
mands. If you do not specify any header fields, retain dis-
plays a list of currently retained header fields.
S[ave] [refs]
saves the specified messages in a file the name of which is
taken from the author of the first message (the file name is
the author's name, without any attached network addressing).
If the folder variable is set, the file is saved to the
specified directory.
s[ave] [refs] [filename]
saves the specified messages in the given file. If no refs
are given, the current message is saved. The file is
created if it doesn't already exist. If you do not specify
filename, mailx saves the messages in mbox. A message that
has been saved with save is normally deleted from mailbox
when mailx terminates (see quit); but see the variables hold
and keepsave.
se[t] [name]
defines a variable with the given name and assigns it a null
value. If you omit name, set displays a list of all defined
variables and their values.
se[t] name=value
defines a variable with the given name and assigns it the
given value. The value may be a string or a number.
se[t] noname
is the same as the unset name command.
11
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
sh[ell]
invokes the shell given by the SHELL environment variable.
si[ze] [refs]
displays the size in bytes of each of the specified mes-
sages. If no refs are specified, the current message is
used.
so[urce] file
reads the specified text file, executes its contents as com-
mand mode commands, then returns to read more commands from
the original source.
to[p] [refs]
displays the first few lines of each of the specified mes-
sages. If no refs are specified, the current message is
used. If the toplines variable has a numeric value, then a
number of lines equal to this value are displayed from each
message; otherwise, five lines are displayed from each mes-
sage.
tou[ch] [refs]
touches the specified messages, making them appear to have
been read. This means that when you quit mailx, the mes-
sages are saved in your mbox if they are not deleted or
explicitly saved in another file. If no refs are specified,
the current message is touched.
T[ype] [refs]
is the same as the Print command.
t[ype] [refs]
is the same as the print command.
una[lias] [alias [name ...]]
deletes specified alias names.
u[ndelete] [refs]
restores previously deleted messages. When messages are
deleted, they are not discarded immediately; they are just
marked for deletion, and are actually deleted when mailx
terminates. Until termination, you can use undelete to
restore the specified messages. You cannot undelete mes-
sages deleted in previous sessions. If you do not give
refs, this command restores the first deleted (but not yet
undeleted) message following the current message; if no such
message exists, it restores the last deleted (but not yet
undeleted) message preceding the current message. If the
autoprint variable is set, the last restored message is
printed. This is the only command that lets you give a ref
to a message which has been deleted.
12
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
U[nread] [refs]
marks the specified messages as unread.
uns[et] name ...
discards the specified variables.
ve[rsion]
displays version information about mailx.
v[isual] [refs]
edits the specified messages with a screen editor. If no
refs are specified, the current message is edited. The mes-
sages are saved in a temporary file and the screen editor is
invoked to edit that file. The editor used is given by the
VISUAL variable; see the ENVIRONMENT VARIABLES section.
w[rite] [refs] filename
writes the specified messages into the given file. If no
refs are given, the current message is written. write is
the same as save except that it does not write out the
header lines and the blank line at the end of the message.
x[it]
is the same as the exit command.
z[+] scrolls the header display forward one screenful.
z- scrolls the header display backward one screenful.
! command
executes the given shell command. For example,
!lc
lists all files in the current directory. The shell that is
invoked to execute the command is given by the SHELL envi-
ronment variable; see the ENVIRONMENT VARIABLES section.
#comment
mailx ignores everything from the # to the end of the line.
This is useful for putting comments into start-up files.
? displays a summary of command mode commands.
= displays the current message number.
Input Mode Commands
You may use input mode commands when entering the text of a mes-
sage. Input mode commands must appear at the beginning of an
input line; they cannot be in the middle of a line. By default,
each input mode command begins with the tilde (~) character,
called the escape character. You may use the escape environment
variable to change the escape character, but the documentation
13
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
that follows uses tilde.
~A inserts the autograph string at this point in the message.
This autograph string is given by the Sign environment vari-
able.
~a is similar to ~A, except that it uses the variable sign.
~b name ...
adds the specified names to the blind carbon copy list.
~c name ...
adds the specified names to the carbon copy list.
~d reads in the dead.letter file; see the description of DEAD
in the ENVIRONMENT VARIABLES section.
~e invokes an editor on the message that you have composed.
The EDITOR variable determines the editor that is invoked.
~F [refs]
forwards the given messages. The text of the messages is
inserted at this point in the message that you are compos-
ing. The message headers are also inserted with all header
fields regardless of the discard, ignore, and retain com-
mands. This is only valid when you entered mailx in command
mode, then went into input mode to compose a message.
~f [refs]
is similar to ~F except that the header fields included are
determined by the discard, ignore, and retain commands.
~h prompts you to enter the following header lines:
Subject Cc Bcc To
For some of these, mailx displays an initial value for the
header. You can edit this initial value as if you had just
typed it in yourself, using backspaces and line deletes.
~i name
inserts the value of the named variable followed by a new-
line at this point in the message.
~M [refs]
inserts the text of the specified messages at this point in
the message. If no refs are specified, the current message
is used. Messages inserted in this way have each line pre-
fixed with the value of the indentprefix variable. The mes-
sage headers are also inserted with all header fields
included regardless of the discard, ignore, and retain com-
mands. This is only valid when you entered mailx in command
mode, then went into input mode to reply to a message.
14
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
~m is similar to ~M except that the header fields included are
determined by the discard, ignore, and retain commands.
~p displays the message being composed.
~q quits input mode as if you had interrupted the message. If
you have already composed part of a message, the partial
message is saved in the dead.letter file; see the descrip-
tion of the DEAD environment variable for more information.
~r filename
reads in the contents of the specified file and adds that
text at this point in the message.
~s text
sets the Subject line to the given text.
~t address address ...
adds the given addresses to the To: list (people who will
receive the message).
~v invokes a screen (visual) editor on the message that you
have composed. The VISUAL variable determines the editor
that is invoked.
~w file
writes the current text of your message to the specified
file. The header lines for the message are not written.
~x quits in the same way as ~q, except that the message is not
saved in the dead.letter file.
~< filename
is the same as the ~r command.
~< !command
executes the given shell command and adds the standard out-
put of that command at this point in the message. For
example, your message might contain
My program is giving me this odd output:
~< !prog
What do you think is causing it?
~| command
pipes the current message through the specified shell com-
mand. If the command terminates with a successful exit sta-
tus, the output of the command replaces the text of the cur-
rent message. For example,
~|fmt
15
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
fills and justifies the lines of your message and replaces
the message with the formatted message. ~| uses the shell
given by the SHELL environment variable to run command.
~! command
executes the given shell command. For example,
~! lc
can be used to obtain a list of files in the current direc-
tory. The shell that is invoked to execute the command is
given by the SHELL environment variable; see the ENVIRONMENT
VARIABLES section. If the bang variable is set, mailx
replaces each unescaped exclamation mark (!) in command with
the command executed by the previous ! command or ~! command
escape.
~. marks the end of input in a mail message.
~: mail_command
executes the given command mode mail_command. This is only
valid when you entered mailx in command mode, then went into
input mode to compose a message.
~_ mail_command
is the same as the ~: command.
~? displays a summary of the input mode commands.
Start-Up Files
When you invoke mailx in command mode, mailx does the following:
1. Sets all variables to their default values. Processes com-
mand-line options, using them to override any corresponding
default values.
2. Imports appropriate external environment variables, using
them to override any corresponding default values.
3. Reads commands from the system start-up file,
/etc/mailx.rcThis sets up variable values and definitions
that should be common to all users. If you do not want
mailx to read the system start-up file, use the -n option on
the mailx command line.
4. Reads your personal start-up file, given by the environment
variable MAILRC. By default, this is the .mailrc under your
home directory.
Typically, start-up files set up display options and define
aliases; however, any command is valid in a start-up file except
for the following:
16
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
Copy edit followup Followup
mail hold preserve reply
Reply respond Respond shell
visual !
If a line in a start-up file contains an error or an invalid com-
mand, the rest of the start-up file is ignored. mailx ignores
blank lines in a start-up file.
EXAMPLES
The following example composes and sends a message to several
users. Items shown in italics are output by mailx itself.
mailx jean
Subject: Greetings
This is just a short note to say hello.
~c juan john johann
~.
On the first line, the message is just addressed to jean. The ~c
line adds more people who will receive copies of the message.
ENVIRONMENT VARIABLES
A large number of variables control the behavior of mailx. These
environment variables are divided into two classes: ones which
always come from the external environment; and ones that may be
set up in either the external environment or within a mailx ses-
sion.
The following variables always come from the external environ-
ment; these can be changed inside a mailx session, except where
marked.
HOME
gives the name of your home directory. This cannot be
changed inside mailx.
LOGNAME
gives your login name.
MAILDIR
gives the name of the directory where system mailboxes are
stored. If this is not set, the default is /usr/mail. The
actual name of a user's system mailbox is derived in a sys-
tem-dependent way by combining MAILDIR and the user's login
name. For mailx to work properly, the MAILDIR directory
must exist.
MAILRC
gives the name of your start-up file. This cannot be
changed inside mailx. By default, MAILRC has the value
$HOME/.mailrc . For more on start-up files, see the
17
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
Start-Up Files section.
The HOME and LOGNAME variables must be set before you enter
mailx; otherwise, mailx does not work properly. These variables
are set automatically for you if you login using the login(1)
facilities. If you do not login, you must set the variables in
some other way, using the commands:
export LOGNAME=name
export HOME=directory
The remaining variables may be set in the external environment or
in the course of a mailx session. The value of a variable may be
set or changed with the set command; a variable may be discarded
with the unset command. You will find it convenient to create a
start-up file that sets these variables according to your prefer-
ences; this eliminates the need to set variables by hand every
time you enter mailx.
Many of the following variables represent on/off options. If you
set the variable itself (to any value), the option is turned on.
To turn the option off, you may unset the variable, or set a
variable consisting of no followed by the name of the original
variable. For example, setting autoprint turns the autoprint
option on, and setting noautoprint turns it off.
allnet
assumes that network addresses with the same login component
refer to the same person. Network addresses typically con-
sist of several components, giving information that lets a
mail server identify a machine on the network, a route to
that machine, and the login name of a user on that machine.
mailx assumes that the login name is the last component.
For example,
print name
displays all messages that originated from the same login
name, regardless of the rest of the network address. The
default is noallnet, where different addresses are assumed
to be different users, even if the login name components are
the same.
append
appends messages to the end of the mbox file upon termina-
tion. The default is noappend; messages are placed at the
beginning of the mbox file instead of the end.
ask prompts you for a Subject: line when composing a message (if
you have not already specified one with the -s option).
This option is turned on by default; to turn it off, set
18
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
noask.
askbcc
prompts you for a Bcc: list when composing a message. The
default is noaskbcc; you are not prompted.
askcc
prompts you for a Cc: list when composing a message. The
default is noaskcc; you are not prompted.
asksub
is the same as ask. noasksub is the same as noask.
autoprint
displays the next message automatically when you delete a
message, and displays messages as you undelete them. The
default is noautoprint; you are not shown messages that you
delete or undelete.
bang
records shell commands executed inside the mailx session
(for example, through the ~! input mode command). Then, if
you issue a shell command and the shell command contains a !
character, mailx replaces that character with the command
line for the previous shell command. The default is nobang,
in which case a ! in a shell command line is not treated
specially.
cmd
contains a command, possibly with options. This specifies a
default command line to be used for the command mode pipe
command. For example,
set cmd="more"
pipes messages through more when the pipe command is
invoked.
conv
specifies that UUCP network addresses are to be converted to
a different style. The conv variable is assigned a code
word indicating the desired style. At present, the only
code word recognized is internet, which stands for the
RFC822 specifications for network mail addressing. To make
use of such addresses, you must have mail server software
that can send and receive messages using such addresses;
MPE/iX Shell and Utilities itself does not provide any soft-
ware for transmitting messages to different systems. By
default, conv is not defined and no conversion takes place.
crt
contains an integer number. If a message has more than this
number of lines, mailx pipes the message through the command
19
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
given by the PAGER variable, whenever it displays the mes-
sage. If this variable is set to null, mailx treats it as a
value of zero and pipes all messages through PAGER. The
default is nocrt.
DEAD
contains the name of a file that can be used as the
dead.letter file. Partial messages are saved in this file
if an interrupt or error occurs during creation of the mes-
sage or delivery. By default, the name of this file is
$HOME/dead.letter.
dot
accepts a line consisting of only a dot (.) as the end of a
message in input mode (it is equivalent to ~.). The default
is nodot. If ignoreeof is set, mailx ignores a setting of
nodot; the dot is the only way to terminate input mode.
EDITOR
gives a command, possibly with options, that is invoked when
using the command mode edit or the input mode ~e. The
default is the ed utility (see ed(1)).
escape
gives the character used to begin input mode commands. The
default is the tilde (~). If this variable is set to null,
mailx disables command escaping.
flipr
reverses the meanings of the R and r commands. The default
is noflipr. See also Replyall.
folder
contains the name of the directory in which mailx saves mail
files. Whenever you specify a file name for a mailx com-
mand, putting a plus sign (+) in front of the name specifies
that the file is to be accessed under the folder directory.
If the value of folder begins with a slash, it is taken as
an absolute path name; otherwise, mailx assumes that the
directory is directly under your HOME directory. folder has
no default value. If it is not set, the plus sign (+) has
no special meaning at the beginning of file names.
20
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
header
displays a summary of message headers at the beginning of a
mailx command mode session. This is the default.
hold
keeps all messages in your system mailbox instead of saving
them in your mbox. The default is nohold.
ignore
ignores interrupts received while composing a message. The
default is noignore.
ignoreeof
ignores EOF markers found while entering a message. The
message can be ended by a dot (.) or ~. on a line by itself.
The default is noignoreeof.
indent
contains a string that mailx uses as a prefix to each line
in messages that ~m and ~M insert. The default is one TAB
character.
indentprefix
the same as indent, contains a string that mailx uses as a
prefix to each line in messages that ~m and ~M insert. The
default is one TAB character. If both indent and
indentprefix are set, indentprefix takes precedence.
keep
does not remove your system mailbox if the mailbox contains
no messages. The mailbox is truncated to zero length. If
the default nokeep is in effect, empty mailboxes are
removed.
keepsave
keeps messages in your system mailbox even if they have been
saved in other files. The default, nokeepsave, deletes mes-
sages from the mailbox if they have been saved elsewhere.
LISTER
contains a command, possibly with options. mailx invokes
this command when displaying the contents of the folder
directory for the folders command. If this variable is null
or unset, mailx uses the ls utility. By default, this vari-
able is unset.
MAILRC
location of personal start-up file. See Start-Up Files.
MBOX
gives the name of your mbox file. Messages that have been
read but not saved elsewhere are saved here when you quit
21
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
(but not when you exit). The default is $HOME/mbox.
metoo
when replying to a message with your login name in the
recipient list, sends a reply to all other recipients, the
author and you. If nometoo is set, you are not sent the
reply. The default is nometoo.
onehop
attempts to send replies directly to the recipients instead
of going through the original author's machine. When you
reply to a message, your reply is sent to the author and all
recipients of the message. On a network, mailx normally
specifies the recipient addresses so that the replies all go
to the original author's machine first, then on to the other
recipients.
outfolder
causes files used to record outgoing messages (see the
description of record) to be located in the directory given
by folder unless folder contains an absolute path name. The
default is nooutfolder.
page
tells the pipe command to insert a formfeed character after
each message that it sends through the pipe. The default is
nopage.
PAGER
contains a command, possibly including options. mailx sends
display output through this command if the output is longer
than the screen length given by screen. The default is the
more utility (see more(1)).
prompt
contains a string that mailx displays to prompt for output
in command mode. The default is a question mark followed by
a space (? ).
quiet
does not display the opening message and version number when
mailx begins a session. The default is noquiet.
record
contains a file name where mailx records every message you
send. If record is not an absolute path name and the
outfolder variable has not been set, the file is located
under the HOME directory. If the outfolder variable is set,
the file is located in your folder directory. The default is
norecord.
Replyall
reverses the senses of the reply and Reply commands (so that
22
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
reply only replies to the author of a message, and Reply
replies to the author and all other recipients). See also
flipr.
save
saves messages in your dead.letter file if they are inter-
rupted while being composed. The name of your dead.letter
file is given by the DEAD variable. Setting nosave disables
this automatic save feature. The default is save.
screen
gives the number of headers that are to be displayed by the
headers and z commands.
sendmail
contains a command, possibly with options, that mailx
invokes to send mail. The default is mail. It can be any
command that takes addresses on the command line and message
contents on standard input.
sendwait
when sending a message through a network, mailx waits for
the mail server to finish before returning to your session.
Normally, it just submits the message to the server, then
returns immediately. The default is nosendwait.
SHELL
contains a command, possibly with options. mailx assumes
that this command is a command interpreter. mailx invokes
this command interpreter whenever it is asked to execute a
system command (for example, through the ! command mode com-
mand). The default is the MPE/iX Shell (see sh(1)).
showto
when displaying a header summary, displays the recipient's
name instead of the author's for messages where you are the
author. The default is noshowto.
sign
contains a string that is inserted into a message when you
use the input mode ~a command. mailx interprets \n and \t
in this string as the newline and tab characters, respec-
tively. The default is nosign.
Sign
contains a string that is inserted into a message when you
use the input mode ~A command. The default is noSign.
toplines
gives the number of header lines that the top command dis-
plays. The default is five.
23
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
TERM
contains the name of the terminal type. If screen is not
set, TERM individually determines the number of lines in a
screenful of headers.
VISUAL
contains a command, possibly with options, that mailx
invokes when using the command mode visual or the input mode
~v. The default is the vi utility (see vi(1)).
FILES
mailx uses the following files:
/etc/mailx.rc
System-wide start-up file.
$MAILRC
Personal start-up file. By default, MAILRC has the value
$HOME/.mailrc.
$HOME/mbox
Default location to save read messages. You can choose a
different file by assigning the file name to the environment
variable MBOX.
$MAILDIR
Directory containing system mailboxes. By default, this is
/usr/mail. You must create the MAILDIR directory if it does
not already exist. For /usr/mail, you can create the direc-
tory with the commands
mkdir /usr
mkdir /usr/mail
if the directory doesn't already exist.
dead.letter
Default location to save partial letters.
DIAGNOSTICS
Possible exit status values are:
0 Successful completion. Also returned if -e is specified and
there is new or unread mail.
1 Returned if -e is specified and there is no new or unread
mail. Also returned to indicate failure because of any of the
following:
-- there is no mail to read
-- inability to create temporary file name or temporary file
-- receipt of user interrupt while composing message
-- inability to determine the user's identity
24
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
2 Failure due to any of the following:
-- missing number after -h
-- missing address after -r
-- missing subject after -s
-- missing user after -u
-- invalid command line option
-- use of interactive options when not using command interactively
Messages
Message: alias storage: system error
Cause: See syserror(3).
Action: See syserror(3).
Message: allocating message address: system error
Cause: See syserror(3).
Action: See syserror(3).
Message: allocating message header system error
Cause: See syserror(3).
Action: See syserror(3).
Message: At EOF
Cause: You tried to advance past the last message in the mail-
box.
Action: Do not issue commands that try to access past the last
message.
Message: cannot find out who you are
Cause: The mailx command was unable to find your user ID.
Action: Check with your system manager.
Message: Cannot "preserve" in edit mode
Cause: You can only use the preserve or hold commands when
working with your system mailbox.
Action: Make sure you are working with your system mailbox if
you want to use the preserve or hold commands.
Message: Command "command" is illegal in startup file.
Cause: Your start-up file contains a command that cannot be
used in such files.
Action: See the Start-Up Files subsection for a list of com-
mands that are not valid in start-up files. Remove the
offending command from your start-up file.
Message: command "command": system error
Cause: See syserror(3).
Action: See syserror(3).
Message: command file "cmdfile name": system error
Cause: See syserror(3).
Action: See syserror(3).
25
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
Message: creating temporary file name: system error
Cause: See syserror(3).
Action: See syserror(3).
Message: else: no matching "if" statement
Cause: You issued an else command without a corresponding if
command.
Action: Ensure that all else commands are preceded by a if com-
mand.
Message: endif: no matching "if" statement
Cause: You issued an endif command without a corresponding if
command.
Action: Ensure that all endif commands are preceded by a if
command.
Message: EOF inside "if" statement
Cause: While processing an if command, mailx encountered an
end-of-file condition.
Action: If the if command is in your start-up file, ensure that
you have included a corresponding endif command. If
you are entering the if in command mode, do not enter
the EOF character before issuing the endif command.
Message: Extra arguments after "command" command
Cause: You included more arguments than command handles.
Action: Check the Command Mode Commands subsection for the cor-
rect arguments for command.
Message: failed
Cause: You tried to pipe output through a command and the com-
mand failed.
Action: Verify that the command being used is a valid MPE/iX
Shell and Utilities command that is capable of reading
from the standard input.
Message: file "filename": system error
Cause: See syserror(3).
Action: See syserror(3).
Message: fork failed: system error
Cause: See syserror(3).
Action: See syserror(3).
Message: fork for shell command: system error
Cause: See syserror(3).
Action: See syserror(3).
Message: fork for shell: system error
Cause: See syserror(3).
Action: See syserror(3).
26
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
Message: if: missing argument
Cause: You did not provide an argument in an if command.
Action: Provide either r or s as the argument of the if com-
mand.
Message: if: "s" or "r" are permissible arguments
Cause: You used an argument other than r or s with the if com-
mand.
Action: Use only r or s as the argument for an if command.
Message: Inappropriate message
Cause: You tried to perform a command on an inappropriate mes-
sage. For example, you tried to undelete a message
that was not deleted or you tried to respond to a
deleted message.
Action: Check the description of the command you are using to
ensure that you are using it correctly.
Message: Invalid hop count: num
Cause: You specified the -h option, but the argument that you
provided with it is not a valid number.
Action: Provide a valid number as the argument to the -h option
Message: Invalid message number
Cause: You used a message number of 0 or one that is greater
than the number of messages in the mailbox.
Action: Use a message number in the range from 1 to the number
of messages in the mailbox.
Message: mail file "file" is locked
Cause: You tried to access a mailbox that another process was
already accessing.
Action: Wait until the other process completes its access then
try again.
Message: mail to command "command name": system error
Cause: See syserror(3).
Action: See syserror(3).
Message: mail to file `filename': system error
Cause: See syserror(3).
Action: See syserror(3).
Message: Mismatched quote char
Cause: You specified the quote character quote char. This
quote character must be paired without a matching mate.
The mate is missing.
Action: Provide the missing mate to quote char.
Message: Missing address after "-r"
Cause: You specified the -r option without providing an
address as its argument.
Action: Provide an address following the -r option.
27
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
Message: Missing file after source command
Cause: You issued a source without specifying a file name.
Action: Specify a file name with the source command.
Message: Missing file name
Cause: You issued a command which requires a file name without
providing one.
Action: Specify a file name.
Message: Missing number of hops after "-h"
Cause: You invoked mailx with the -h option without providing
a value following it.
Action: Provide a value following the -h option.
Message: Missing subject after "-s"
Cause: You invoked mailx with the -s option without providing
a subject string following it.
Action: Provide a subject string following the -s option.
Message: Missing user after "-u"
Cause: You invoked mailx with the -u option without providing
a user name following it.
Action: Provide a user name following the -u option.
Message: No applicable messages
Cause: You specified a message list that does not match any
messages in the current mailbox.
Action: No action required.
Message: No messages satisfy :colon modifier
Cause: You specified a colon modifier (one of :d, :n, :o, :r,
or :u) as your message list and none of the messages in
the current mailbox matched it.
Action: No action required
Message: No previous file.
Cause: You used # to represent the file name of the previous
file when there was no previous file.
Action: Use a different file name indicator.
Message: No value set for folder variable"
Cause: You have not provided a value for the mailx variable
folder.
Action: Provide a value for the variable folder either in the
start-up file or in command mode.
Message: Non-numeric second argument
Cause: The second argument in a message list was not numeric.
Action: Ensure that, when specifying a range of messages as
arguments for a command, you indicate the first and
last message in the range with integers in the range 1
to the number of messages in the current mailbox.
28
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
Message: not in interactive mode
Cause: You attempted to use an interactive mode command
(through ~:) when you did not invoke mailx in interac-
tive mode.
Action: Invoke mailx in interactive mode to use interactive
mode commands.
Message: Option -option argument missing
Cause: You did not provide an argument for -option.
Action: Provide the missing argument.
Message: Options applying only to interactive use were given.
Cause: You specified the -e, -f, -H, -N, or -u options when
attempting to send mail. These options are only for
use when reading mail.
Action: Check the Options subsection for usable options when
sending mail.
Message: pathname: system error
Cause: See syserror(3).
Action: See syserror(3).
Message: read error: system error
Cause: See syserror(3).
Action: See syserror(3).
Message: Referencing before first message
Cause: You used the - notation to try to reference the message
before the first one in the mailbox.
Action: Do not use - when the current message is the first mes-
sage in the mailbox.
Message: Referencing beyond last message
Cause: You used the + notation to try to reference the next
message when the current message was the last one in
the mailbox.
Action: Do not use + when the current message is the last mes-
sage in the mailbox.
Message: rewriting "filename": system error
Cause: See syserror(3).
Action: See syserror(3).
Message: temporary file "filename": system error
Cause: See syserror(3).
Action: See syserror(3).
Message: Too many mail folders specified on command line.
Cause: When specifying the -f option, you named more than one
mail folder on the command line.
Action: List only one file name on the command line.
29
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
Message: Unknown command "command"
Cause: You entered a command that does that not exist in
mailx.
Action: Verify that you spelled the command name properly and
that it is a valid mailx command.
Message: Unknown command "~command". Type ~? for help.
Cause: You entered an input mode command that does not exist.
Action: Check the Input Mode Commands subsection to ensure that
the command is valid. Remember that ~ is the default
escape character and may be changed by the escape vari-
able.
Message: Unknown option "-option"
Cause: You specified a command line option that is not valid
for mailx.
Action: Check the Options subsection for a list of valid mailx
options.
Message: Unknown colon modifier ":colon modifier"
Cause: You used an unknown colon modifier in a message list.
Action: Check the Command Mode Commands subsection for a list
of valid colon modifiers.
Message: variable: no such variable
Cause: You tried to make use of a variable that does not
exist.
Action: Check to make sure that you have spelled the variable
name correctly or define the variable with a set com-
mand.
Message: variable: read-only variable
Cause: You cannot change the values of some environment vari-
ables, such as HOME and MAILRC, from within mailx. You
tried to change the value of such a variable.
Action: Do not try to change the value of read-only variables.
Message: variable "cmd" not set
Cause: You invoked the pipe command without any arguments and
have not assigned a value to the cmd environment vari-
able. This variable indicates the default command to
pipe messages through.
Action: Assign a value to cmd.
Message: variable storage: system error
Cause: See syserror(3).
Action: See syserror(3).
Message: write error: system error
Cause: See syserror(3).
Action: See syserror(3).
30
mailx(1) MPE/iX Shell and Utilities mailx(1)
______________________________________________________________________
PORTABILITY
POSIX.2. x/OPEN Portability Guide 4.0. UNIX System V.
UNIX System V has a compatible mailx utility while Berkeley sys-
tems have a similar utility known as Mail.
The -d, -F, -r, and -U options, the Copy, echo, followup, Fol-
lowup, Save, Unread, and version commands, and the allnet, conv,
onehop, replyall, sendmail, and sendwait variables are extensions
to the POSIX standard.
MPE/iX NOTES
Since the current MPE/iX implementation of mailx does not support
the native MPE mailer, you cannot use it to send mail to other
systems. On MPE/iX, it uses the tsmail delivery agent.
Also,since an MPE/iX child process cannot survive the death of
its parent, you should always use mailx with the variable
sendwait turned on. By default, this variable is turned off; how-
ever, the default system configuration file for mailx (-
/etc/mailx.rc) contains a line that turns it on.
For more information on how the current MPE/iX implementation may
affect the operation of this utility, see Appendix A, MPE/iX
Implementation Considerations.
SEE ALSO
echo(1), ed(1), fmt(1), sh(1), vi(1), tsmail(3)
31