MAIL(1) — HP-UX
NAME
mail, rmail − send mail to users or read mail
SYNOPSIS
mail [ + ] [ −epqr ] [ −f file ]
mail [ −dt ] person ...
rmail [ −dt ] person ...
DESCRIPTION
Note: An enhanced user mail interface is presented in mailx(1).
Mail without arguments prints a user’s mail, message-by-message, in last-in, first-out order. For each message, the user is prompted with a ?, and a line is read from the standard input to determine the disposition of the message. Commands that automatically proceed to the next message will exit from mail if already on the last message. The following is a list of commands:
<new-line> Go on to next message. Exit if already on last message.
+ Same as <new-line>.
n Same as <new-line>.
d Delete message and go on to next message.
p Print message again.
− Go back to previous message.
s [ files ] Save message in the named files (mbox is default), mark the message for deletion from the user’s mailfile and proceed to next message.
y [ files ] Same as s.
w [ files ] Save message without its header (the “From ...” line), in the named files (mbox is default), mark the message for deletion, and go on to next message.
m person ... Mail the message to each named person, mark the message for deletion, and go on to next message.
q Put undeleted mail back in the mailfile and stop.
EOT (control-d) Same as q.
x Put all mail back in the mailfile unchanged and stop.
!command Escape to the command interpreter to do command.
? Print a command summary.
The following optional arguments alter the printing of the mail:
+ Cause messages to be printed in first-in, first-out order.
−e Cause mail not to be printed. An exit value is returned:
0 = Mail present
1 = No mail
2 = Other error
−p Cause all mail to be printed without prompting for disposition.
−q causes mail to terminate after interrupts. Normally an interrupt only causes the termination of the printing of the current message.
−r Same as +.
−f file Causes mail to use file (for example, mbox) instead of the default mailfile.
When persons are named, mail takes the standard input up to an end-of-file (or up to a line consisting of just a .) and adds it to each person’s mailfile. The message is preceded by the sender’s name and a postmark.
The −t option causes the message to be preceded by each person the mail is sent to. A person is usually a user name recognized by login(1). If a person being sent mail is not recognized, or if mail is interrupted during input, the file dead.letter will be saved to allow editing and resending. Note that this is regarded as a temporary file in that it is recreated every time needed, erasing the previous contents of dead.letter.
The −d option causes mail to deliver mail directly. This isolates mail from making routing decisions and allows it to be used as a local delivery agent. Typically this option is used by auto-routing facilities when they deliver mail locally.
To denote a recipient on a remote system, prefix person by the system name and exclamation mark (see uucp(1)). Everything after the first exclamation mark in person is interpreted by the remote system. In particular, if person contains additional exclamation marks, it can denote a sequence of machines through which the message is to be sent on the way to its ultimate destination. For example, specifying a!b!cde as a recipient’s name causes the message to be sent to user b!cde on system a. System a will interpret that destination as a request to send the message to user cde on system b. This might be useful, for instance, if the sending system can access system a but not system b, and system a has access to system b. Mail will not use uucp if the remote system is the local system name (i.e., localsystem!user).
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. This is especially useful to forward all of a person’s mail to one machine in a multiple machine environment. In order for forwarding to work properly the mailfile should have "mail" as group ID, and the group permission should be read-write.
Rmail only permits the sending of mail; uucp(1) uses rmail as a security precaution.
When a user logs in, the presence of mail, if any, is indicated. Also, notification is made if new mail arrives while using mail.
FILES
/usr/mail/∗.lock Lock for mail directory
dead.letter Unmailable text
/tmp/ma∗ Temporary file
$MAIL Variable containing path name of mailfile
$HOME/mbox Saved mail
/etc/passwd To identify sender and locate persons
/usr/mail Directory for incoming mail
(mode “775”, group ID “mail”)
/usr/mail/user Incoming mail for user; that is, the mailfile
(mode “660”, group ID “mail”)
WARNINGS
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.
Lines that look like postmarks in the message, (that is, “From ...”) are preceded with a >.
Mail treats a line consisting solely of a dot (“.”) as the end of the message.
SEE ALSO
login(1), mailx(1), uucp(1), write(1).
INTERNATIONAL SUPPORT
mail: 8- and 16-bit data, 8-bit file names.
Hewlett-Packard Company — May 11, 2021