NAME
mail, binmail - Sends and displays messages from system
users
SYNOPSIS
mail [-e] | [-pqrt] [-d directory_path] | [-f file]
mail user ... [< file]
binmail [-e] | [-pqrt] [-d directory_path] | [-f file]
binmail user ... [< file]
The mail command writes to standard output all stored mail
addressed to the your login name, one message at a time, or
sends a mail message to another user or users.
FLAGS
-d directory_path
Saves mail in the specified directory instead of the
directory /usr/spool/mail. (This flag cannot be used
with -f).
-e Does not display any messages. This flag causes mail to
return an exit value of 0 (zero) if the user has mail
and an exit value of 1 if the user has no mail.
-f file
Saves mail to and reads mail from file instead of in the
default mail file, $HOME/mbox. (This flag cannot be
used with -d.)
-p Displays mail without prompting for a disposition code.
This flag does not delete, copy, or forward any mes-
sages.
-q Causes mail to exit when you press the Interrupt key
sequence.
Normally, pressing the Interrupt key sequence stops only
the message being displayed. (In this case, the next
message sometimes does not display until you enter the p
subcommand.)
-r Displays mail in first-in, first-out order.
-t Prefixes each message with the names of all recipients
of the mail. (Normally, only the individual recipient's
name appears as addressee.)
DESCRIPTION
Following each message, mail prompts you with a ? question
mark. Press <Return> to display the next mail message, or
enter one of the subcommands that control the disposition of
the message.
When sending mail, you specify users, and then mail reads a
message from standard input until you press the End-of-File
key sequence or enter a line containing only a . (dot). It
prefixes this message with the sender's name and the date
and time of the message (its postmark) and adds this message
to the file /var/spool/mail/user for each user specified on
the command line.
Usually, user is a name recognized by the login command. If
the system does not recognize one or more of the specified
users or if mail is interrupted during input, mail saves
messages in the file $HOME/dead.letter to allow for editing
and resending.
The action of mail can be modified in two ways by manipulat-
ing /var/spool/mail/user:
o The default permission assignment for other users is
read-only. If you change this permission assignment to
read/write or to All Permissions Denied, the system
preserves the file, even when it is empty, in order to
maintain the desired permissions; you will not be able
to remove the file.
o You can edit the file to contain the following as its
first line:
Forward to person
This causes all messages sent to user to be sent to
person instead. The Forward to feature is especially
useful for sending all of a person's mail to a particu-
lar machine in a network environment.
To specify a recipient on a remote system, prefix the system
name and an ! (exclamation mark) to user. See the uucp com-
mand for a detailed discussion of how to address remote sys-
tems. Also see mailx and sendmail for other network connec-
tions.
SUBCOMMANDS
The following subcommands control message disposition.
+ Displays the next mail message (the same as pressing
<Return>).
- Displays the previous message.
d Deletes the current message and displays the next mes-
sage.
p Displays the current message again.
s [file]
Saves the message in file instead of in the default mail
file $HOME/mbox.
w [file]
Saves the message, without its postmark, in file instead
of in the default mail file, $HOME/mbox.
m user
Forwards the message to user.
q Writes any mail not yet deleted to /var/spool/mail/user
and exits. Pressing the End-of-File key sequence has
the same effect.
x Writes all mail unchanged to /var/spool/mail/user and
exits.
!system_command
Runs the specified command.
* (asterisk)
Displays a subcommand summary.
help
Displays a subcommand summary.
EXAMPLES
1. To display your mail, enter:
mail
After the most recent message is displayed, a ? (ques-
tion mark) indicates that mail is waiting for one of
the subcommands explained previously (+, -, d, p, and
so on). Enter help or an * (asterisk) to list the sub-
commands available.
2. If the End-of-File key sequence is <Ctrl-d>, you send
mail to other users by entering:
mail tom rachel
Don't forget the meeting tomorrow at 9:30.
<Ctrl-d>
In this example, the system mails the message Don't
forget the meeting tomorrow at 9:30. to the users tom
and rachel. The End-of-File key sequence (in this
case, <Ctrl-d>) indicates the end of the message, but
it is not sent with the text.
3. To send a file to another user, enter:
mail fran < proposal
This command sends the contents of the file proposal to
fran.
4. To save a message to the default mail file, enter:
mail
This command displays each message mailed to you.
Press <Return> after the ? prompt until the desired
message is displayed.
When the appropriate message is displayed, enter:
s
The message is saved in the default mail file,
$HOME/mbox.
5. To save a message to a specific file, enter:
mail
This command displays each message mailed to you.
Press <Return> after the ? prompt until the desired
message is displayed. When the appropriate message is
displayed, enter:
s mycopy
This command saves the message in a file named mycopy
in the current directory, rather than in the default
mail file.
FILES
$HOME/mbox Holds saved mail.
$HOME/dead.letter
Holds unmailable text.
/etc/passwd
Contains user information.
/var/spool/mail/user
Holds incoming mail for user.
/var/spool/mail/user/.lock
Lock for mail directory.
EXIT VALUES
For information about exit values, see the FLAGS section.
RELATED INFORMATION
Commands: login(1), mailx(1)/Mail(1), sendmail(8),
write(1), uucp(1).
Acknowledgement and Disclaimer