MAIL(1) SysV MAIL(1)
NAME
mail, rmail - send mail to users or read mail
SYNOPSIS
Sending mail:
mail [ -oswt ] persons
rmail [ -oswt ] persons
Reading mail:
mail [ -ehpqr ] [ -f file ] [ -F persons ]
DESCRIPTION
Sending mail:
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 (CTRL/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 mailfile 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 (unless the -s argument was
used).
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 resending. The dead.letter file is recreated every
time it is needed, erasing any previous contents.
The rmail command 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 system. 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.
Reading Mail:
The mail program, unless otherwise influenced by command-line arguments,
prints a user's mail messages in last-in, first-out order. For each
message, the user is prompted with a question mark (?), and a line is
read from the standard input. The following commands are available to
determine the disposition of the message:
<newline>, +, or n Go on to next message.
d, or dp Delete message and go on to next message.
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.
- 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 mailfile 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 indicated. 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
perpetuate 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 mail has been forwarded. Installation and removal of
forwarding is done with the -F option.
To forward all of one's mail to systema!user enter the following:
mail -Fsystema!user
To forward to more than one user, enter this command line:
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.
To remove forwarding, enter the following:
mail -F ""
The pair of double quotes is mandatory to set a NULL argument for the -F
option.
In order for forwarding to work properly, the mailfile should have "mail"
as group ID and the group permission should be read-write.
OPTIONS
Sending mail:
-o Suppresses the address optimization facility.
-s Suppresses the addition of a <newline> at the top of the letter
being sent. See WARNINGS below.
-w Causes a letter to be sent to a remote user without waiting for the
completion of the remote transfer program.
-t Causes a To: line to be added to the letter, showing the intended
recipients.
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 BI 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.
WARNING
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."
The -s option should be used with caution. It allows the text of a
message to be interpreted as part of the postmark of the letter, possibly
causing confusion to other mail programs. To allow compatibility with
mailx(1), if the first line of the message is "Subject:...", the addition
of a <newline> is suppressed whether or not the -s option is used.
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.
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).
Using Your SysV Environment.
Managing SysV System Software.