MAILX(1) DOMAIN/IX Reference Manual (SYS5) MAILX(1)
NAME
mailx - interactive message processing system
USAGE
mailx [options] [name...]
DESCRIPTION
Mailx provides a comfortable, flexible environment for send-
ing and receiving messages electronically. To help you read
your mail, mailx has commands for saving, deleting, and
responding to messages. If you are sending mail, mailx
allows you to interactively edit, review, and otherwise
modify messages.
A standard file for each user, called the system mailbox for
that user, holds incoming mail. When mailx is called to
read messages, the mailbox is the default place to find
them. As you read messages, mailx marks them to be moved to
a secondary file for storage, so that the messages need not
be seen again (unless you specify otherwise). This secon-
dary file is called the mbox and is normally located in your
HOME directory. Messages remain in this file until they are
forcibly removed.
At any time, the behavior of mailx is governed by a set of
environment variables. These are flags and valued parame-
ters that are set and cleared using the set and unset com-
mands.
On the command line, options start with a dash (-). Mailx
takes any other arguments to be destinations (recipients).
If you specify no recipients, mailx attempts to read mes-
sages from the mailbox.
Recipients listed on the command line may be of three types:
log-in names, Shell commands, or alias groups. Log-in names
may be any network address, including mixed network address-
ing. If the recipient name begins with a pipe symbol (|),
the rest of the name is taken to be a Shell command to pipe
the message through. This provides an automatic interface
with any program that reads the standard input, for record-
ing outgoing mail on paper. Alias groups are set by the
alias command, and are lists of recipients of any type.
When reading mail, mailx is in command mode. It displays a
header summary of the first several messages, followed by a
prompt indicating that it is ready to accept regular com-
mands.
Regular commands are of this form: [command] [msglist]
[arguments].
Printed 6/10/85 MAILX-1
MAILX(1) DOMAIN/IX Reference Manual (SYS5) MAILX(1)
If you fail to specify a command while mailx is in command
mode, print is assumed. In input mode, commands are recog-
nized by the escape character, and lines not treated as com-
mands are taken as input for the message.
Each message is assigned a sequential number. Mailx also
uses the notion of a ``current'' message, marked by a
greater-than sign (>), in the header summary. Many commands
take an optional list of messages (msglist) to operate on,
which defaults to the current message. A msglist is a list
of message specifications separated by spaces, which may
include the following:
n Message number n.
. The current message.
^ The first undeleted message.
$ The last message.
* All messages.
n-m An inclusive range of message numbers.
user All messages from user.
/string All messages with string in the subject line
(case ignored).
:c All messages of type c, where c is one of the
following:
d deleted messages
n new messages
o old messages
r read messages
u unread messages
Note that the context of the command determines
whether this type of message specification
makes sense.
Other arguments are usually arbitrary strings whose usage
depends on the command involved. Filenames, where expected,
are expanded using the normal Shell conventions. See sh (1)
for more on this. Special characters are recognized by cer-
tain commands and are documented with the commands below.
When sending mail, mailx is in input mode. If it finds no
subject on the command line, mailx prints a prompt for the
subject. As you type the message, mailx will read the mes-
sage and store it in a temporary file. Commands may be
entered by beginning a line with the tilde (~) escape char-
acter followed by a single command letter and optional argu-
ments.
At start-up time, mailx reads commands from a system-wide
file (/usr/lib/mailx/mailx.rc) to initialize certain parame-
ters, then from a private start-up file ($HOME/.mailrc) for
personalized variables. Most regular commands are legal
inside start-up files, the most common use being to set up
MAILX-2 Printed 6/10/85
MAILX(1) DOMAIN/IX Reference Manual (SYS5) MAILX(1)
initial display options and alias lists. The following com-
mands are not legal in the start-up file: !, Copy, edit,
followup, Followup, hold, mail, preserve, reply, Reply,
shell, and visual. Any errors in the start-up file cause
the remaining lines in the file to be ignored.
COMMANDS
The following is a complete list of mailx commands:
!shell-command
Escape to the Shell.
#comment
Null command (comment). This may be useful in .mailrc
files.
= Print the current message number.
? Print a summary of commands.
alias alias name ...
group alias name ...
Declare an alias for the given names. Substitute the
names when alias is a recipient. Useful in the .mailrc
file.
alternates name ...
Declare a list of alternate names for your log-in.
When responding to a message, remove these names from
the list of recipients for the response. With no argu-
ments, alternates prints the current list of alternate
names. Refer to the allnet environment variable.
cd [directory]
chdir [directory]
Change directory. If you do not specify directory,
mailx uses $HOME.
copy [filename]
copy [msglist] filename
Copy messages to the file without marking the messages
as saved. Otherwise, this command is equivalent to the
save command.
Copy [msglist]
Save the specified messages in a file whose name is
derived from the author of the message to be saved,
without marking the messages as saved. Otherwise, this
command is equivalent to the Save command.
delete [msglist]
Delete messages from the mailbox. If the autoprint
Printed 6/10/85 MAILX-3
MAILX(1) DOMAIN/IX Reference Manual (SYS5) MAILX(1)
environment variable is set, print the next message
after the last one deleted.
discard [header-field ...]
ignore [header-field ...]
Suppress printing of the specified header fields when
displaying messages on the screen. Examples of header
fields to ignore are ``status'' and ``cc''. The fields
are included when the message is saved. The Print and
Type commands override this command.
dp [msglist]
dt [msglist]
Delete the specified messages from the mailbox and
print the next message after the last one deleted.
Roughly equivalent to a delete command followed by a
print command.
echo string
Echo the given strings, as in echo (1).
edit [msglist]
Edit the given messages. Place the messages in a tem-
porary file, and use the EDITOR variable to get the
name of the editor. The default editor is ed (1).
exit
xit Exit from mailx without changing the mailbox. Save no
messages in mbox (see also quit).
file [filename]
folder [filename]
Quit from the current file of messages and read in the
specified file. Several special characters are recog-
nized when used as filenames, with the following sub-
stitutions:
% the current mailbox.
% user
the mailbox for user.
# the previous file.
& the current mbox.
The default file is the current mailbox.
folders
Print the names of the files in the directory set by
the folder variable.
followup [message]
Respond to a message, recording the response in a file
whose name is derived from the author of the message.
Override the record variable, if set. See also the
Followup, Save, and Copy commands, and the outfolder
MAILX-4 Printed 6/10/85
MAILX(1) DOMAIN/IX Reference Manual (SYS5) MAILX(1)
variable.
Followup [msglist]
Respond to the first message in the msglist, sending
the message to the author of each message in the
msglist. Take the subject line from the first message,
and record the response in a file whose name is derived
from the author of the first message. See also the
followup, Save, and Copy commands and the outfolder
variable.
from [msglist]
Print the header summary for the specified messages.
group alias name ...
alias alias name ...
Declare an alias for the given names. Substitute the
names when alias is a recipient. Useful in the .mailrc
file.
headers [msglist]
Print the page of headers that includes the message
specified. The screen variable sets the number of
headers per page. See also the z command.
help Print a summary of commands.
hold [msglist]
preserve [msglist]
Hold the specified messages in the mailbox.
i s|r
mail-commands
else
mail-commands
endif
Make executions conditional, where s executes following
mail-commands up to an else or endif, if the program is
in send mode, and r executes mail-commands only when
the program is in receive mode. Useful in the .mailrc
file.
ignore header-field ...
discard header-field ...
Suppress printing of the specified header fields when
displaying messages on the screen. Examples of header
fields to ignore are ``status'' and ``cc''. All fields
are included when the message is saved. The Print and
Type commands override this command.
list Print all commands available, without supplying any
explanations of them.
Printed 6/10/85 MAILX-5
MAILX(1) DOMAIN/IX Reference Manual (SYS5) MAILX(1)
mail name ...
Mail a message to the specified users.
mbox [msglist]
Arrange for the given messages to end up in the stan-
dard mbox save file when mailx terminates normally.
See also the exit and quit commands.
next [msglist]
Go to the next message matching msglist. You may
specify a msglist, but only the first valid message in
the list will be used. This command is helpful for
jumping to the next message from a specific user, since
the name will be taken as a command in the absence of a
real command. See the discussion of msglist above for
a description of possible message specifications.
pipe [msglist] [shell-command]
| [msglist] [shell-command]
Pipe the message through the given shell-command. Treat
the message as if it were read. If no arguments are
given, pipe the current message through the command
specified by the value of the cmd variable. If the
page variable is set, insert a form feed character
after each message.
preserve [msglist]
hold [msglist]
Preserve the specified messages in the mailbox.
Print [msglist]
Type [msglist]
Print the specified messages on the screen, including
all header fields. Override suppression of fields by
the ignore command.
print [msglist]
type [msglist]
Print the specified messages. If the crt variable is
set, page the messages longer than the number of lines
specified by that variable through the command speci-
fied by the PAGER variable.
quit Exit from mailx, storing messages that were read in
mbox and unread messages in the mailbox. Delete mes-
sages that have been explicitly saved in a file.
Reply [msglist]
Respond [msglist]
Send a response to the author of each message in the
msglist. Take the subject line from the first message.
If the record variable is set to a filename, save the
MAILX-6 Printed 6/10/85
MAILX(1) DOMAIN/IX Reference Manual (SYS5) MAILX(1)
response at the end of that file.
reply [msglist]
respond [msglist]
Reply to the specified message, including all other
recipients of the message. If the record variable is
set to a filename, save the response at the end of that
file.
Save [msglist]
Save the specified messages in a file whose name is
derived from the author of the first message. Inter-
pret the name of the file as the author's name with all
network addressing stripped off. See also the Copy,
followup, and Followup commands, and the outfolder
environment variable.
save [filename]
save [msglist] filename
Save the specified messages in the given file. Create
the file if it does not exist. Delete the message from
the mailbox when mailx terminates, unless the keepsave
environment variable is set. See also the exit and
quit commands.
set
set name
set name=string
set name=number
Define a variable called number. The variable may have
a null, string, or numeric value. Set by itself prints
all defined variables and their values.
shell
Invoke an interactive Shell. Refer to the SHELL vari-
able.
size [msglist]
Print the size, in characters, of the specified mes-
sages.
source filename
Read commands from the given file and return to command
mode.
top [msglist]
Print the top few lines of the specified messages. If
the toplines variable is set, use its value as the
number of lines to print. The default is 5.
touch [msglist]
Touch the specified messages. If any message in
Printed 6/10/85 MAILX-7
MAILX(1) DOMAIN/IX Reference Manual (SYS5) MAILX(1)
msglist is not specifically saved in a file, it will be
placed in the mbox upon normal termination. See exit
and quit.
Type [msglist]
Print [msglist]
Print the specified messages on the screen, including
all header fields. Override suppression of fields by
the ignore command.
type [msglist]
print [msglist]
Print the specified messages. If the crt variable is
set, page the messages longer than the number of lines
specified by that variable through the command speci-
fied by the PAGER variable.
undelete [msglist]
Restore the specified deleted messages. Only messages
deleted in the current mail session are restored. If
the autoprint variable is set, print the last message
of those restored.
unset name ...
Erase the specified variables. If a variable was
imported from the execution environment (i.e., a Shell
variable), then it cannot be erased.
version
Print the current version and release date.
visual [msglist]
Edit the given messages with a screen editor. Place
the messages in a temporary file, and use the VISUAL
variable to get the name of the editor.
write [msglist] filename
Write the given messages on the specified file, minus
the header and trailing blank line. Otherwise, this
command is equivalent to the save command.
xit
exit Exit from mailx, without changing the mailbox. Save no
messages in the mbox (see also quit).
z[+|-]
Scroll the header display forward or backward one full
screen. Use the screen variable to set the number of
headers displayed.
TILDE ESCAPES
The following commands may be entered only from input mode,
MAILX-8 Printed 6/10/85
MAILX(1) DOMAIN/IX Reference Manual (SYS5) MAILX(1)
by beginning a line with the tilde escape character (~).
See the escape variable for changing this special character.
~!shell-command
Escape to the Shell.
~. Simulate end-of-file (terminate message input).
~ : mail command
~_mail-command
Perform the command-level request. Valid only when
sending a message while reading mail.
~? Print a summary of tilde escapes.
~A Insert the autograph string Sign variable into the mes-
sage.
~a Insert the autograph string sign variable into the mes-
sage.
~bname...
Add the names to the blind carbon copy (Bcc) list.
~cname...
Add the names to the carbon copy (Cc) list.
~d Read in the dead.letter file. See the DEAD environment
variable for a description of this file.
~e Invoke the editor on the partial message. See also the
EDITOR environment variable.
~f [msglist]
Forward the specified messages. The messages are
inserted into the message, without alteration.
~h Prompt for Subject line and To, Cc, and Bcc lists. If
the field is displayed with an initial value, it may be
edited as if you had just typed it.
~istring
Insert the value of the named variable into the text of
the message. For example, ~A is equivalent to ~i Sign.
~m [msglist]
Insert the specified messages into the letter, shifting
the new text to the right one tab stop. Valid only
when sending a message while reading mail.
~p Print the message being entered.
Printed 6/10/85 MAILX-9
MAILX(1) DOMAIN/IX Reference Manual (SYS5) MAILX(1)
~q Quit from input mode by simulating an interrupt. If
the body of the message is not null, the partial mes-
sage is saved in dead.letter. See the DEAD environment
variable for a description of this file.
~rfilename
~< filename
~< !shell-command
Read in the specified file. If the argument begins
with an exclamation point (!), the rest of the string
is taken as an arbitrary Shell command and is executed,
with the standard output inserted into the message.
~sstring...
Set the subject line to string.
~tname...
Add the given names to the To list.
~v Invoke a preferred screen editor on the partial mes-
sage. Refer to the VISUAL environment variable.
~wfilename
Write the partial message onto the given file, without
the header.
~x Exit as with ~q except the message is not saved in
dead.letter.
~ | shell-command
Pipe the body of the message through the given shell-
command. If the shell-command returns a successful exit
status, the output of the command replaces the message.
ENVIRONMENT VARIABLES (EXTERNAL)
The following are environment variables taken from the exe-
cution environment. They cannot be altered within mailx.
HOME = directory
The user's base of operations.
MAILRC = filename
The name of the start-up file. The default is
$HOME/.mailrc.
ENVIRONMENT VARIABLES (INTERNAL)
The following variables are internal mailx variables. They
may be imported from the execution environment or set using
the set command at any time. The unset command may be used
to erase variables.
allnet
MAILX-10 Printed 6/10/85
MAILX(1) DOMAIN/IX Reference Manual (SYS5) MAILX(1)
Treat all network names whose last component (log-in
name) match as identical. This causes the msglist mes-
sage specifications to behave similarly. The default
is noallnet. Refer to the alternates command and the
metoo variable.
append
Upon termination, append messages to the end of the
mbox file instead of prepending them. The default is
noappend.
askcc
Prompt for the Cc list after the message is entered.
The default is noaskcc.
asksub
Prompt for the subject if it is not specified on the
command line with the -s option. This variable is
enabled by default.
autoprint
Enable automatic printing of messages after delete and
undelete commands. The default is noautoprint.
bang Enable the special-casing of exclamation points (!) in
Shell escape command lines as in vi (1). The default
is nobang.
cmd=shell-command
Set the default command for the pipe command. There is
no default value for this variable.
conv=conversion
Convert uucp (1) addresses to the specified address
style. The only valid conversion now is Internet,
which requires a mail delivery program conforming to
the RFC822 standard for electronic mail addressing. By
default, the conversion is disabled. Refer to the
sendmail variable and the -U command line option.
crt=number
Pipe messages having more than number lines through the
command specified by the value of the PAGER variable.
Disabled by default.
DEAD=filename
Specify the name of the file in which to save partial
letters in case of untimely interrupt or delivery
errors. The default is $HOME/dead.letter.
debug
Enable verbose diagnostics for debugging. Messages are
Printed 6/10/85 MAILX-11
MAILX(1) DOMAIN/IX Reference Manual (SYS5) MAILX(1)
not delivered. The default is nodebug.
dot Take a period on a line by itself during input from a
terminal as end-of-file. The default is nodot.
EDITOR=shell-command
Specify the editing command to run when the edit or ~e
command is used. The default is ed. Refer to the line
editor, ed (1).
escape=c
Substitute c for the ~ escape character.
folder=directory
Represent the directory for saving standard mail files.
User-specified filenames beginning with a plus (+) are
expanded by preceding the filename with this directory
name to obtain the real filename. If directory does
not start with a slash (/), $HOME is prepended to it.
In order to use the plus (+) construct on a mailx com-
mand line, the ``folder'' must be an exported sh (1)
environment variable. There is no default for the
folder variable. Refer to outfolder below.
header
Enable printing of the header summary when entering
mailx. By default, this variable is enabled.
hold Preserve all messages that are read in the mailbox
instead of putting them in the standard mbox save file.
The default is nohold.
ignore
Ignore interrupts while entering messages. This is
handy for noisy dial-up lines. The default is noig-
nore.
ignoreeof
Ignore end-of-file during message input. Input must be
terminated by a period (.) on a line by itself or by
the ~. command. The default is noignoreeof. Refer to
dot above.
keep When the mailbox is empty, truncate it to zero length
instead of removing it. By default, this variable is
disabled.
keepsave
Keep messages that have been saved in other files in
the mailbox instead of deleting them. The default is
nokeepsave.
MAILX-12 Printed 6/10/85
MAILX(1) DOMAIN/IX Reference Manual (SYS5) MAILX(1)
MBOX=filename
Represent the name of the file to save messages that
have been read. The xit command overrides this func-
tion, as does saving the message explicitly in another
file. The default is $HOME/mbox.
metoo
Do not delete log-ins appearing as recipients from the
list. The default is nometoo.
LISTER=shell-command
The command (and options) to use when listing the con-
tents of the ``folder'' directory. The default is ls
(1).
onehop
When responding to a message that was originally sent
to several recipients, the other recipient addresses
are normally forced to be relative to the originating
author's machine for the response. This flag disables
alteration of the recipients' addresses, improving
efficiency in a network where all machines can send
directly to all other machines (i.e., one hop away).
outfolder
Causes the files used to record outgoing messages to be
located in the directory specified by the folder vari-
able unless the pathname is absolute. The default is
nooutfolder. Refer to folder above and the Save, Copy,
followup, and Followup commands.
page Used with the pipe command to insert a form feed after
each message sent through the pipe. The default is
nopage.
PAGER=shell-command
The command to use as a filter for paginating output.
This can also be used to specify the options to be
used.
prompt=string
Set the command mode prompt to string. The default is a
question mark (?).
quiet
Refrain from printing the opening message and version
when entering mailx. The default is noquiet.
record=filename
Record all outgoing mail in filename. By default, this
variable is disabled. Refer to outfolder above.
Printed 6/10/85 MAILX-13
MAILX(1) DOMAIN/IX Reference Manual (SYS5) MAILX(1)
save Enable saving of messages in dead.letter on interrupt
or delivery error. Refer to the DEAD variable for a
description of this file. By default, this variable is
enabled.
screen=number
Set the number of lines in a full screen of headers for
the headers command.
sendmail=shell-command
Serve as an alternate command for delivering messages.
The default is mail (1).
sendwait
Wait for background mailer to finish before returning.
The default is nosendwait.
SHELL=shell-command
Represent the name of a preferred command interpreter.
The default is sh (1).
showto
When displaying the header summary and the message is
from you, print the recipient's name instead of the
author's name.
sign=string
Represent the variable inserted into the text of a mes-
sage when the ~a (autograph) command is given. There
is no default for this (refer to ~i).
Sign=string
Represent the variable inserted into the text of a mes-
sage when the ~A command is given. There is no default
for this (refer to ~i).
toplines=number
Represent the number of lines of header to print with
the top command. The default is five.
VISUAL=shell-command
Represent the name of a preferred screen editor. The
default is vi. Refer to the display-oriented editor,
vi (1).
OPTIONS
-d Turn on debugging output.
-e Test for the presence of mail. Mailx prints
nothing and exits with a successful return
code if there is mail to read.
MAILX-14 Printed 6/10/85
MAILX(1) DOMAIN/IX Reference Manual (SYS5) MAILX(1)
-f filename Read messages from filename instead of mail-
box. If you do not specify a filename, mailx
uses the mbox.
-F Record the message in a file named after the
first recipient. Overrides the record vari-
able, if it is set.
-h number Use number to indicate the number of network
``hops'' made so far. This is provided for
network software to avoid infinite delivery
loops.
-H Print header summary only.
-i Ignore interrupts. Refer to the ignore
environment variable..
-n Do not initialize from the system default
Mailx.rc file.
-N Do not print initial header summary.
-r address Pass address to network delivery software.
Disable all tilde commands.
-s subject Set the ``Subject'' header field to subject.
-u user Read user's mailbox. This is only effective if
user's mailbox is not read-protected.
-U Convert uucp (1) style addresses to Internet
standards. Override the conv environment
variable.
CAUTIONS
Where shell-command is shown as valid, arguments are not
always allowed. Experimentation is recommended.
Internal variables imported from the execution environment
cannot be unset.
Mailx does not yet support the full Internet addressing.
Attempts to send a message having a line consisting only of
a period (.) are treated as the end of the message by mail
(1), the standard mail delivery program.
FILES
$HOME/.mailrc personal start-up file
$HOME/mbox secondary storage file
/usr/mail/* post office directory
Printed 6/10/85 MAILX-15
MAILX(1) DOMAIN/IX Reference Manual (SYS5) MAILX(1)
/usr/lib/mailx/mailx.help* help message files
/usr/lib/mailx/mailx.rc global start-up file
/tmp/R[emqsx]* temporary files
RELATED INFORMATION
ls (1), mail (1).
MAILX-16 Printed 6/10/85