MAIL(1) INTERACTIVE UNIX System MAIL(1)
NAME
mail, rmail - send mail to users or read mail
SYNOPSIS
Sending mail:
mail [ -wt ] persons
rmail [ -wt ] persons
Reading mail:
mail [ -ehpqr ] [ -f file ] [ -F persons ]
DESCRIPTION
Sending mail:
The command-line options that follow affect SENDING mail:
-w causes a letter to be sent to a remote user without
waiting for the completion of the remote transfer pro-
gram.
-t causes a To: line to be added to the letter, showing
the intended recipients.
A person is usually a user name recognized by login(1).
When persons are named, mail assumes a message is being sent
(except in the case of the -F option). It reads from the
standard input up to an end-of-file (control-d), or until it
reads a line consisting of just a period. When either of
those signals is received, mail adds the letter to the mail-
file for each person. A letter is a message preceded by a
postmark. The message is preceded by the sender's name and
a postmark. A postmark consists of one or more 'From' lines
followed by a blank line.
If a letter is found to be undeliverable, it is returned to
the sender with diagnostics that indicate the location and
nature of the failure. If mail is interrupted during input,
the file dead.letter is saved to allow editing and resend-
ing. dead.letter is recreated every time it is needed,
erasing any previous contents.
rmail only permits the sending of mail; uucp(1C) uses rmail
as a security precaution.
If the local system has the Basic Networking Utilities
installed, mail may be sent to a recipient on a remote sys-
tem. Prefix person by the system name and exclamation
point. A series of system names separated by exclamation
points can be used to direct a letter through an extended
network.
Rev. Base System Page 1
MAIL(1) INTERACTIVE UNIX System MAIL(1)
Reading Mail:
The command-line options that follow affect READING mail:
-e causes mail not to be printed. An exit value of 0 is
returned if the user has mail; otherwise, an exit value
of 1 is returned.
-h causes a window of headers to be displayed rather than
the latest message. The display is followed by the ?
prompt.
-p causes all messages to be printed without prompting for
disposition.
-q causes mail to terminate after interrupts. Normally an
interrupt causes only the termination of the message
being printed.
-r causes messages to be printed in first-in, first-out
order.
-ffile
causes mail to use file (e.g., mbox) instead of the
default mailfile.
-Fpersons
entered into an empty mailbox, causes all incoming mail
to be forwarded to persons.
mail, unless otherwise influenced by command-line options,
prints a user's mail messages in last-in, first-out order.
For each message, the user is prompted with a ?, and a line
is read from the standard input. The following commands are
available to determine the disposition of the message:
<new-line>, +, or n Go on to next message.
d or dp Delete message and go on to next mes-
sage.
d # Delete message number #. Do not go on
to next message.
dq Delete message and quit mail.
h Display a window of headers around
current message.
h # Display header of message number #.
h a Display headers of ALL messages in the
user's mailfile.
h d Display headers of messages scheduled
for deletion.
p Print current message again.
Rev. Base System Page 2
MAIL(1) INTERACTIVE UNIX System MAIL(1)
- Print previous message.
a Print message that arrived during the
mail session.
# Print message number #.
r [ users ] Reply to the sender, and other
user(s), then delete the message.
s [ files ] Save message in the named files (mbox
is default).
y Same as save.
u [ # ] Undelete message number # (default is
last read).
w [ files ] Save message, without its top-most
header, in the named files (mbox is
default).
m [ persons ] Mail the message to the named persons.
q, or ctl-d Put undeleted mail back in the mail-
file and quit mail.
x Put all mail back in the mailfile
unchanged and exit mail.
!command Escape to the shell to do command.
? Print a command summary.
When a user logs in, the presence of mail, if any, is indi-
cated. Also, notification is made if new mail arrives while
using mail.
The mailfile may be manipulated in two ways to alter the
function of mail. The other permissions of the file may be
read-write, read-only, or neither read nor write to allow
different levels of privacy. If changed to other than the
default, the file will be preserved even when empty to per-
petuate the desired permissions. The file may also contain
the first line:
Forward to person
which will cause all mail sent to the owner of the mailfile
to be forwarded to person. A "Forwarded by..." message is
added to the header. This is especially useful in a multi-
machine environment to forward all of a person's mail to a
single machine and to keep the recipient informed if the
Rev. Base System Page 3
MAIL(1) INTERACTIVE UNIX System MAIL(1)
mail has been forwarded. Installation and removal of for-
warding is done with the -F option.
To forward all of one's mail to systema!user enter:
mail -Fsystema!user
To forward to more than one user enter:
mail -F"user1,systema!user2,systema!systemb!user3"
Note that when more than one user is specified, the whole
list should be enclosed in double quotes so that it may all
be interpreted as the operand of the -F option. The list
can be up to 1024 bytes; either commas or white space can be
used to separate users.
The following list of characters are prohibited from appear-
ing anywhere in the mail -F argument list or in the "Forward
to" line:
; & | ^ < > ` ( ) <CR>
To remove forwarding enter:
mail -F ""
The pair of double quotes is mandatory to set a NULL argu-
ment for the -F option.
For forwarding to work properly, the mailfile should have
"mail" as group ID, and the group permission should be
read-write.
FILES
/etc/passwd to identify sender and locate persons
/usr/mail/user incoming mail for user; i.e., the mailfile
$HOME/mbox saved mail
$MAIL variable containing path name of mailfile
/tmp/ma* temporary file
/usr/mail/*.lock lock for mail directory
dead.letter unmailable text
SEE ALSO
login(1), mailx(1), write(1).
Rev. Base System Page 4
MAIL(1) INTERACTIVE UNIX System MAIL(1)
WARNINGS
The "Forward to person" feature may result in a loop if
sys1!userb forwards to sys2!userb and sys2!userb forwards to
sys1!userb. The symptom is a message saying
"unbounded...saved mail in dead.letter."
BUGS
Conditions sometimes result in a failure to remove a lock
file.
After an interrupt, the next message may not be printed;
printing may be forced by typing a p.
Rev. Base System Page 5