mailx(1)
_________________________________________________________________
mailx Command
interactive message processing system
_________________________________________________________________
SYNTAX
mailx [ option ... ] [ username ... ]
DESCRIPTION
Mailx provides a comfortable, flexible environment for sending
and receiving messages electronically. When sending mail, mailx
lets you edit, review, and modify a message as you enter it.
When reading mail, mailx lets you save, delete, and reply to
messages.
At any time, the behavior of mailx is governed by a set of
environment variables. These are flags and valued parameters
which are set and cleared via the set and unset commands. See
ENVIRONMENT VARIABLES below.
Each user's incoming mail is stored in a file called the user's
mailbox. The mailbox is in /usr/mail, the default location where
mailx reads messages. After a message is read, it is moved to a
secondary file, called the mbox, unless other action is
specified. Your mbox is normally located in your $HOME directory
(see MBOX under ENVIRONMENT VARIABLES below). Messages remain in
this file until you remove them.
Username indicates a destination or recipient for sending mail
and can be any of the following:
login name The login name or network address of a user to
whom you are sending mail. The address syntax for
communication between systems depends on the
delivery agent specified with the environment
variable ``sendmail.'' The default is mail, which
uses uucp-style pathnames such as
sys49!sys22!jones (see uux(1C)).
shell command A pipe symbol followed by a login name and a shell
command through which the message will be piped.
This provides an automatic interface with any
program that reads the standard input, such as
lp(1) for recording outgoing mail on paper.
alias group A group name set by the alias command (see
COMMANDS below). A group contains a list of user
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
mailx(1)
names.
If you omit username, mailx reads mail.
Options are:
-d Turn on debugging output. Debugging output is verbose
and therefore we do not recommend using this option.
-e Test for presence of mail. Mailx prints nothing and
exits with a successful return code if there is mail to
read.
-f [path] Read messages from file path instead of mailbox. If
path is omitted, the mbox is used.
-F Record the outgoing message in a file named after the
first recipient. This overrides the ``record''
variable (see ENVIRONMENT VARIABLES) and is valid only
when sending mail.
-h num Specify the number of network ``hops'' made so far.
This is used only by network software (to avoid
infinite delivery loops).
-H Print the header summary only.
-i Ignore interrupts. See also ``ignore'' under
ENVIRONMENT VARIABLES.
-n Do not initialize from the system default Mailx.rc
file.
-N Do not print initial header summary.
-r addr Pass address addr and disable all tilde commands (see
TILDE ESCAPES). This is used only by network delivery
software.
-s subj Set the Subject header field to subj. This is valid
only when sending mail.
-u user Read user's mailbox. This is only effective if user's
mailbox is not read protected.
-U Convert uucp-style addresses to internet standards;
override the ``conv'' environment variable (see
ENVIRONMENT VARIABLES).
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)
mailx(1)
Sending mail
When sending mail, mailx is in input mode. If no subject is
specified on the command line, a prompt for the subject is
printed. As the message is typed, mailx reads the message and
stores it in a temporary file. Commands may be entered by
beginning a line with the tilde (~) escape character followed by
a single command letter and optional arguments. See TILDE
ESCAPES below for a summary of these commands.
A mail message has two parts, separated by a blank line:
* The mail header, which contains header lines added by mailx
or other mail-handling programs. A header line consists of
a header field (like "cc" or ">From") followed by text.
* The body of the text, which you type in.
Mailx generates four possible header fields in a message:
To: the addresses of each of the recipients
Cc: the recipients of ``carbon copies''
Bcc: the recipients of ``blind'' carbon copies
Subject: the topic of the message
When mail is passed between systems, mailers may attach various
headers fields such as ``Message-Id: ...'' or ``Received: ....''
The message body remains untouched.
Every recipient receives a list of the `To' and `Cc' recipients
but not of the `Bcc' recipients.
Reading mail
When reading mail, mailx is in command mode. A "header summary"
of the first several messages is displayed, followed by a prompt
indicating mailx can accept regular commands (see COMMANDS
below). Note that the "header summary" is not the same thing as
a header or header field--see "Sending mail," above, for
definitions of those terms. At the top of the mail message,
mailx prints all header fields added by various mailers.
Messages have various states. When first received, mail is N(ew)
and U(nread). Once mail is read or touched, mailx saves it in
the save file if it exists. Mail held in the mailbox with the
preserve command will be redisplayed the next time you invoke
mailx but will be flagged as an old message.
DG/UX 4.00 Page 3
Licensed material--property of copyright holder(s)
mailx(1)
Message lists
Each message is assigned a sequential number, and there is at any
time the notion of a 'current' message, marked by a '>' in the
header summary. Many commands take an optional list of messages
(msglist) to operate on. If you don't specify such a list, the
command will just operate on the current message by default. A
msglist is a list of message specifications (listed below)
separated by spaces. Except for the specification * (all
messages), several specifications can be combined on a single
line. You must use * by itself.
Note that if any of the specifications fail to match at least one
message, then the command you typed will fail for all
specifications.
n Message number n.
. The current message.
^ The first undeleted message.
$ The last message.
+ The next undeleted message.
- The previous undeleted 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:
d deleted messages
n new messages
o old messages
r read messages
u unread messages
The context of the command determines whether this
type of message specification makes sense.
Other arguments are usually arbitrary strings whose syntax
depends on the command involved. Filenames, where expected, are
expanded via the normal shell conventions (see sh(1)). Special
characters are recognized by certain commands and are documented
with the commands below.
Several of the mailx commands send messages. These commands
place you in input mode and read in the text to be sent. To exit
from input mode, at the beginning of a line type ^D or type . and
press NEW LINE.
Start-up
At start-up time, mailx reads commands from a system-wide file
DG/UX 4.00 Page 4
Licensed material--property of copyright holder(s)
mailx(1)
(/usr/lib/mailx/mailx.rc) to initialize certain parameters, 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 initial display
options and alias lists. The following commands are not legal in
the start-up file: !, edit, followup, Followup, mail, reply,
Reply, respond, Respond, shell, and visual. Most errors in the
start-up file cause the remaining lines in the file to be
ignored. However, using the ! command causes a warning, but the
remaining lines are executed.
Changes made to the mailbox are not preserved if an error occurs
when the mailbox is written after you enter the quit command.
When you invoke mailx again, the mailbox will be as it were at
the beginning of the previous session.
COMMANDS
Mailx commands are of the form:
[ command ] [ msglist ] [ argument ... ]
If no command is specified in command mode (you just type <nl>),
then print will run on the current message. In input mode,
commands are recognized by the escape character, and lines not
treated as commands are taken as input for the message.
Following is a complete list of mailx commands:
!shell-command
Escape to the shell, execute shell-command, and return. See
SHELL under ENVIRONMENT VARIABLES.
# comment
Null command (comment). This may be useful in .mailrc
files.
= Print the current message number.
alias [alias name ...]
group [alias name ...]
Declare an alias for the given names. The names will be
substituted when alias is used as a recipient. Useful in
the .mailrc file. With no arguments, alias prints the list
of current aliases.
alternates [name ...]
Declare a list of alternate names for your login. When
responding to a message, these names are removed from the
list of recipients for the response. With no arguments,
DG/UX 4.00 Page 5
Licensed material--property of copyright holder(s)
mailx(1)
alternates prints the current list of alternate names. See
also ``allnet'' under ENVIRONMENT VARIABLES.
cd [directory]
chdir [directory]
Change directory. If directory is not specified, $HOME is
used.
copy [[msglist] filename]
Copy messages to the file without marking the messages as
saved. Otherwise equivalent to the save command. With no
arguments, copy saves the current message in the default
save file.
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 equivalent to the Save
command.
delete [msglist]
Delete messages from the mailbox. If ``autoprint'' is set,
the next message after the last one deleted is printed (see
ENVIRONMENT VARIABLES).
discard [header-field ...]
ignore [header-field ...]
Suppress printing of header lines beginning with header-
field when displaying messages on the screen. Examples of
header-field are ``status'', ``>From'', and ``cc'' (see
``Sending mail'' above). Don't include the colon at the end
of the header field; it's not actually part of the field.
You can't ignore the first header field. Note that the
fields are ignored only as they are printed to the screen;
they are not deleted from the mail message. The Print and
Type commands override this command, printing all header
fields.
dp [msglist]
dt [msglist]
Delete the specified messages from the mailbox and print the
next message after the last one deleted. This is equivalent
to a delete command followed by a print command.
echo string ...
Echo the given strings (same as echo(1)).
edit [msglist]
Edit the given messages. The messages are placed in a
temporary file and the EDITOR variable is used to get the
name of the editor (see ENVIRONMENT VARIABLES). Default
DG/UX 4.00 Page 6
Licensed material--property of copyright holder(s)
mailx(1)
editor is ed(1). The read state (read or unread) remains
unchanged.
exit
xit Exit from mailx, without changing the mailbox. No messages
are saved in the mbox (see also quit).
file [filename]
folder [filename]
Quit reading messages from the current file and begin
reading from the specified file. Several special characters
are recognized when used as filenames, with the following
substitutions: If you omit the argument, information is
printed about the current file.
% 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 (see ENVIRONMENT VARIABLES).
followup [message]
Respond to a message, recording the response in a file whose
name is derived from the author of the message. Overrides
the ``record'' variable, if set. See also the Followup,
Save, and Copy commands and ``outfolder'' (ENVIRONMENT
VARIABLES).
Followup [msglist]
Respond to the first message in the msglist, sending the
response to the author of each message in the msglist. The
subject line is taken from the first message and the
response is recorded in a file whose name is derived from
the author of the first message. See also the followup,
Save, and Copy commands and ``outfolder'' (ENVIRONMENT
VARIABLES).
from [msglist]
Print the header summary for the specified messages.
headers [message]
Print the page of headers which includes the message
specified. The ``screen'' variable sets the number of
headers per page (see ENVIRONMENT VARIABLES). See also the
z command.
DG/UX 4.00 Page 7
Licensed material--property of copyright holder(s)
mailx(1)
help
? Print a summary of commands.
hold [msglist]
preserve [msglist]
Hold the specified messages in the mailbox.
if s|r
mail-command ...
else
mail-command ...
endif
Execute the commands following if if the condition is true;
otherwise execute the commands following else. S is true in
send mode; r is true in receive mode. Conditional execution
is useful in the .mailrc file.
list Prints all commands available. No explanation is given.
mail name ...
Go into input mode and mail a message to the specified
users.
mbox [msglist]
Arrange for the given messages to end up in the standard
mbox save file when mailx terminates normally. See MBOX
under ENVIRONMENT VARIABLES for a description of this file.
See also the exit and quit commands.
next [message]
Go to next message matching message. A msglist may be
specified, but in this case the first valid message in the
list is the only one used. This is useful for jumping to
the next message from a specific user. See the discussion
of msglists above for a description of possible message
specifications.
pipe [[msglist] shell-command]
| [[msglist] shell-command]
Pipe the message through the given shell-command. The
message is treated as if it were read. If no arguments are
given, the current message is piped through the command
specified by the value of the ``cmd'' variable. If the
``page'' variable is set, a form feed character is inserted
after each message (see ENVIRONMENT VARIABLES).
Print [msglist]
Type [msglist]
Print the specified messages on the screen, including all
header fields. Overrides suppression of fields by the
discard command.
DG/UX 4.00 Page 8
Licensed material--property of copyright holder(s)
mailx(1)
print [msglist]
type [msglist]
Print the specified messages. If ``crt'' is set, the
messages longer than the number of lines specified by the
``crt'' variable are paged through the command specified by
the PAGER variable. The default command is pg(1) (see
ENVIRONMENT VARIABLES).
quit Exit from mailx, storing messages that were read in mbox and
unread messages in the mailbox. Messages that have been
explicitly saved in a file are deleted.
Reply [msglist]
Respond [msglist]
Send a reply to the author of each message in the msglist.
The subject line is taken from the first message. If
``record'' is set to a filename, the reply is saved at the
end of that file (see ENVIRONMENT VARIABLES).
reply [message]
respond [message]
Reply to the specified message, including all other
recipients of the message. If ``record'' is set to a
filename, the response is saved at the end of that file (see
ENVIRONMENT VARIABLES).
Save [msglist]
Save the specified messages in a file whose name is derived
from the author of the first message. The name of the file
is taken to be the author's name with all network addressing
stripped off. See also the Copy, followup, and Followup
commands and ``outfolder'' (ENVIRONMENT VARIABLES).
save [[msglist] filename]
Save the specified messages in the given file. The file is
created if it does not exist. The message is deleted from
the mailbox when mailx terminates unless ``keepsave'' is set
(see also ENVIRONMENT VARIABLES and the exit and quit
commands).
set [name[=value]]
Define a variable called name. The variable may be given a
null, string, or numeric value. Set with no argument prints
all defined variables and their values (see ENVIRONMENT
VARIABLES). The command ``set novariable'' is the same as
``unset variable.''
shell
Invoke an interactive shell (see also SHELL under
ENVIRONMENT VARIABLES).
DG/UX 4.00 Page 9
Licensed material--property of copyright holder(s)
mailx(1)
size [msglist]
Print the size in characters of the specified messages.
source filename
Read and execute commands from the given file and return to
command mode. If a command in the file fails, the rest of
the commands are not executed and the user is returned to
command mode.
top [msglist]
Print the top few lines of the specified messages. If the
``toplines'' variable is set, it is taken as the number of
lines to print (see ENVIRONMENT VARIABLES). The default is
5.
touch [msglist]
Touch the specified messages. If any message in msglist is
not specifically saved in a file, it will be placed in the
mbox upon normal termination. See exit and quit.
undelete [msglist]
Restore the specified deleted messages. Will only restore
messages deleted in the current mail session. If
``autoprint'' is set, the last message of those restored is
printed (see ENVIRONMENT VARIABLES).
unset name ...
Causes the specified variables to be erased. If the
variable was imported from the execution environment (i.e.,
a shell variable) then it cannot be erased.
version
Prints the current version and release date of mailx.
visual [msglist]
Edit the given messages with a screen editor. The messages
are placed in a temporary file and the VISUAL variable is
used to get the name of the editor (see ENVIRONMENT
VARIABLES). The read state (read or unread) remains
unchanged.
write [msglist] filename
Write the given messages to the specified file, minus the
first line of the header and the trailing blank line at the
end of the message body. Otherwise equivalent to the save
command.
z[+|-]
Scroll the header summary forward or backward one screenful.
The number of headers displayed is set by the ``screen''
variable (see ENVIRONMENT VARIABLES).
DG/UX 4.00 Page 10
Licensed material--property of copyright holder(s)
mailx(1)
TILDE ESCAPES
The following commands may be entered only from input mode, by
beginning a line with the tilde escape character (~). See
``escape'' (ENVIRONMENT VARIABLES) for changing this special
character.
~! shell-command
Escape to the shell, execute shell-command, and return.
~. 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'' into the message (see
ENVIRONMENT VARIABLES).
~a Insert the autograph string ``sign'' into the message (see
ENVIRONMENT VARIABLES).
~b name ...
Add the names to the blind carbon copy (Bcc) list.
~c name ...
Add the names to the carbon copy (Cc) list.
~d Read in the dead.letter file. See DEAD under ENVIRONMENT
VARIABLES for a description of this file.
~e Invoke the editor on the partial message. See also EDITOR
under ENVIRONMENT VARIABLES.
~f [msglist]
Forward the specified messages by inserting them into the
outgoing 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.
~i string
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
DG/UX 4.00 Page 11
Licensed material--property of copyright holder(s)
mailx(1)
new text to the right one tab stop. Valid only when sending
a message while reading mail.
~p Print the message being entered.
~q Quit from input mode by simulating an interrupt. If the
body of the message is not null, the partial message is
saved in dead.letter. See DEAD under ENVIRONMENT VARIABLES
for a description of this file.
~r filename | !shell-command
~< 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.
~s string ...
Set the subject line to string.
~t name ...
Add the given names to the To list.
~v Invoke a preferred screen editor on the partial message.
See also VISUAL under ENVIRONMENT VARIABLES.
~w filename
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
The following are environment variables taken from the execution
environment and are not alterable within mailx.
HOME=directory
The user's base of operations.
MAILRC=filename
The name of the start-up file. Default is $HOME/.mailrc.
The following variables are internal mailx variables. They may
DG/UX 4.00 Page 12
Licensed material--property of copyright holder(s)
mailx(1)
be imported from the execution environment or set via the set
command at any time. The unset command may be used to erase
variables.
allnet
All author pathnames with the same last component (login
name) are treated as identical when msglist is specified
with that login name as ``user.'' Default is noallnet. See
also the alternates command and the ``metoo'' variable.
append
Upon termination, append messages to the end of the mbox
file instead of prepending them. Default is noappend.
askcc
Prompt for the Cc list after message is entered. Default is
noaskcc.
asksub
Prompt for subject if it is not specified on the command
line with the -s option. Enabled by default.
autoprint
Enable automatic printing of messages after delete and
undelete commands. Default is noautoprint.
bang Enable the special-casing of exclamation points (!) in shell
escape command lines as in vi(1). This lets exclamation
points be quoted and treated as normal characters. Default
is nobang.
cmd=shell-command
Set the default command for the pipe command. No default
value.
conv=conversion
Convert uucp 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. Conversion is disabled by
default. See also sendmail(1) 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 (pg(1)
by default). Disabled by default.
DEAD=filename
The name of the file in which to save partial letters in
case of untimely interrupt or delivery errors. Default is
DG/UX 4.00 Page 13
Licensed material--property of copyright holder(s)
mailx(1)
$HOME/dead.letter.
debug
Enable verbose diagnostics for debugging. Messages are not
delivered. Default is nodebug.
dot Take a period on a line by itself during input from a
terminal as end-of-file. Default is nodot.
EDITOR=shell-command
The command to run when the edit or ~e command is used.
Default is ed(1).
escape=c
Substitute c for the ~ escape character.
flipf=directory
Switch the meaning of followup" and "Followup."
flipm=directory
Switch the meaning of mail and Mail.
flipr=directory
Switch the meaning of reply and Reply.
folder=directory
Specify a directory for saving or reading mail files. When
you use a mailx command with a filename argument, a filename
beginning with a plus (+) is 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 the mailx command line, folder must be an
exported sh environment variable. There is no default for
the folder variable. See also ``outfolder'' below.
header
Enable printing of the header summary when entering mailx.
Enabled by default.
hold Preserve all messages that are read in the mailbox instead
of putting them in the standard mbox save file. Default is
nohold.
ignore
Ignore interrupts while entering messages. Handy for noisy
dial-up lines. Default is noignore.
ignoreeof
Ignore end-of-file during message input. Input must be
terminated by a period (.) on a line by itself or by the ~.
DG/UX 4.00 Page 14
Licensed material--property of copyright holder(s)
mailx(1)
command. Default is noignoreeof. See also ``dot'' above.
keep When the mailbox is empty, truncate it to zero length
instead of removing it. Disabled by default.
keepsave
When keepsave is set, messages that you save (save, Save,
write) are kept in mbox when you quit. If both keepsave and
hold are set, such messages will be kept in mailbox. When
keepsave is not set, such messages are thrown away when you
quit. The default is nokeepsave.
MBOX=filename
The name of the file to save messages which have been read.
The xit command overrides this function, as does saving the
message explicitly in another file. Default is $HOME/mbox.
metoo
Include your login in the recipient list when mailing to an
alias list containing your login name. Default is nometoo,
which suppresses the sending of mail to yourself as part of
an alias list.
LISTER=shell-command
The command (and options) to use when listing the contents
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''
variable unless the pathname is absolute. Default is
nooutfolder. See ``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. 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. Default
is pg(1).
DG/UX 4.00 Page 15
Licensed material--property of copyright holder(s)
mailx(1)
prompt=string
Set the command mode prompt to string. Default is `? '.
quiet
Refrain from printing the opening message and version when
entering mailx. Default is noquiet.
record=filename
Record all outgoing mail in filename. Disabled by default.
See also ``outfolder'' above.
save Enable saving of messages in dead.letter on interrupt or
delivery error. See DEAD for a description of this file.
Enabled by default.
screen=number
Sets the number of lines in a screenful of headers for the
headers command.
sendmail=shell-command
Alternate command for delivering messages. Default is
mail(1).
sendwait
Wait for background mailer to finish before returning.
Default is nosendwait.
SHELL=shell-command
The name of a preferred command interpreter. 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
The variable inserted into the text of a message when the ~a
(autograph) command is given. No default (see also ~i
(TILDE ESCAPES)).
Sign=string
The variable inserted into the text of a message when the ~A
command is given. No default (see also ~i (TILDE ESCAPES)).
toplines=number
The number of lines of header to print with the top command.
Default is 5.
VISUAL=shell-command
The name of a preferred screen editor. Default is vi(1).
DG/UX 4.00 Page 16
Licensed material--property of copyright holder(s)
mailx(1)
FILES
$HOME/.mailrc personal start-up file
$HOME/mbox secondary storage file
/usr/mail/* post office directory
/usr/lib/mailx/mailx.help* help message files
/usr/lib/mailx/mailx.rc global start-up file
/tmp/R[emqsx]* temporary files
SEE ALSO
mail(1), pg(1), ls(1).
BUGS
Where shell-command is shown as valid, arguments are not always
allowed. Experimentation is recommended.
The full internet addressing is not fully supported by mailx.
Attempts to send a message having a line consisting only of a
``.'' are treated as the end of the message by mail(1) (the
standard mail delivery program).
DG/UX 4.00 Page 17
Licensed material--property of copyright holder(s)