mail Command mail
Computer mail
mail [-mpqrv] [-f file] [user ...]
mail allows you to exchange electronic mail with other COHERENT
system users, either on your own system or on other systems via
UUCP. If one or more users are specified, mail reads a message
from the standard input, appends the date and the sender's name,
and sends the result to each user. mail prints the prompt
Subject:
on the screen, requesting that you give the message a title. A
message can be terminated with an end-of-file character (<ctrl-
D>), a line that contains only the character `.', or a line that
contains only the character `?'. If a message is ended with a
question mark, mail feeds the message into an editor for further
editing. The editor used is the one named in the user's .profile
with the command line export EDITOR=editor; if no editor is named
in .profile, it uses ed. After a message is ended, if you have
defined environmental variable ASKCC to YES, you will be asked
for a list of users to carbon copy the message to.
mail looks up each user in file /usr/lib/mail/aliases. If there
is a match, the new name is used in place of user. If user is of
the form
sys!user
or
sys! ... !user
it is treated as a UUCP destination. mail then invokes uucp com-
mand to pass the message to sys, whose responsibility it becomes
to pass the message to user.
For local users, mail writes its messages into the file
/usr/spool/mail/user. This file is called the user's ``mail-
box''; Each user who has received mail is greeted by the message
``You have mail.'' when she logs in. mail normally changes the
contents of the mailbox as the user works with them; however,
mail has options that allow the contents of the mailbox to remain
unchanged if the user desires.
If no user is given, mail reads and displays the user's mail mes-
sage by message. If environmental variable PAGER is defined,
mail will ``pipe'' each message through the command specified in
COHERENT Lexicon Page 1
mail Command mail
PAGER. For example, the .profile command line:
export PAGER="exec /bin/scat -1"
would invoke /bin/scat for each mail message with the command
line argument -1 (the digit one).
The following commands allow the user to save, delete, or send
each message to another user interactively.
d Delete the current message and print the next message.
m [user ...]
Mail the current message to each user given (default: your-
self).
p Print the current message again.
q Quit, and update mailbox file to reflect changes.
r Reverse the direction in which the mailbox is being scanned.
s [file ...]
Save the current mail message with the usual header in each
file (default: $HOME/mbox).
t [user ...]
Send a message read from the standard input, terminated by
an end-of-file character or by a line containing only `.' or
`?', to each user (default: yourself).
w [file ...]
Write the current message without the usual header in each
file (default: $HOME/mbox).
x Exit without updating the mailbox file.
<newline>
Print the next message.
- Print the previous message.
EOF Quit, updating mailbox; same as q.
? Print a summary of available commands.
!command
Pass command to the shell for execution.
The following command line options control the sending and
reading of mail.
COHERENT Lexicon Page 2
mail Command mail
-f file
Read mail from file instead of from the default,
/usr/spool/mail/user.
-m Send a message to the terminal of user if she is logged into
the system when mail is sent.
-p Print all mail without interaction.
-q Quit without changing the mailbox if an interrupt character
is typed. Normally, an interrupt character stops printing
of the current message.
-r Reverse the order of printing messages. Normally, mail
prints messages in the order in which they were received.
-v Verbose mode. Show the version number of the mail program,
and display expanded aliases.
If you wish, you can create a signature file, .sig.mail, in your
home directory. mail appends the contents of the signature file
to the end of every mail message, as a signature. A signature
can be your system's path name (for uucp messages), your
telephone number, an amusing bon mot, or what you will.
***** Files *****
$HOME/dead.letter -- Message that mail could not send
$HOME/mbox -- Default saved mail
$HOME/.aliases -- Personal mail alias file
$HOME/.sig.mail -- Signature file
/etc/passwd -- User identities
/etc/utmp -- Logged in users
/tmp/mail* -- Temporary and lock files
/usr/lib/mail/aliases -- Aliases of users
/usr/spool/mail -- Mailbox directory, filed by user name
***** See Also *****
ASKCC, commands, msg, PAGER, write
***** Notes *****
mail stores mail for a given user in file /usr/spool/mail/user.
user owns this file, and can therefore permit or deny access to
the mail by other users.
COHERENT Lexicon Page 3