mail(1) mail(1)NAME mail, rmail - send mail to users or read mail SYNOPSIS mail [-e] [-ffile] [-p] [-q] [-r] [-t] address ... rmail [-t] address ... DESCRIPTION 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 stan- dard input to determine the disposition of the message: newline Go on to next message. + Same as newline. d Delete message and go on to next mes- sage. p Print message again. - Go back to previous message. s [file...] Save message in the named files (mbox is default). w [file...] Save message, without its header, in the named files (mbox is default). m [address...] Mail the message to the named addresses (yourself is default). q Put undeleted mail back in the mailfile and stop. EOT (CONTROL-d) Same as q. x Put all mail back in the mailfile un- changed and stop. !command Escape to the shell to perform command. * Print a command summary. The optional arguments alter the printing of the 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. -p causes all mail to be printed without prompting for disposition. -q causes mail to terminate after interrupts. Nor- mally an interrupt only causes 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. When address is 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 address's mailfile. The message is preceded April, 1990 1
mail(1) mail(1)by the sender's name and a postmark. Lines that look like postmarks in the message, (i.e., From...) are preceded with a >. The -t flag option causes the message to be preceded by all addresses the mail is sent to. An address is usually a user name recognized by login(1). If an address being sent mail is not recognized, or if mail is interrupted dur- ing input, the file dead.letter will be saved to allow edit- ing and resending. Note that this is regarded as a tem- porary file in that it is recreated every time needed, eras- ing the previous contents of dead.letter. To denote a recipient on a remote system, prefix address by the system name and exclamation mark (see uucp(1C)). Every- thing after the first exclamation mark in address is inter- preted by the remote system. In particular, if address con- tains 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 send- ing system can access system a but not system b, and system a has access to system b. mail will not use uucp if the re- mote 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 per- petuate the desired permissions. The file may also contain the first line: Forward to address which will cause all mail sent to the owner of the mailfile to be forwarded to address. This is especially useful to forward all of a user's mail to one machine in a multiple machine environment. In order for forwarding to work prop- erly, the mailfile should have mail as group ID, and the group permission should be read-write. rmail permits only the sending of mail; uucp(1C) uses rmail as a security precaution. 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. 2 April, 1990
mail(1) mail(1)EXAMPLES mail cj accepts whatever message is typed up to an EOF. The user cj will be notified that he has mail the next time he logs in. If you want to read mail that has been sent to you, simply type mail FILES /bin/mail /bin/rmail /etc/passwd to identify sender and locate user ad- dresses /usr/mail/user incoming mail for user; i.e., the mailfile $HOME/mbox saved mail $MAIL variable containing pathname of mail- file /tmp/ma* temporary file /usr/mail/*.lock lock for mail directory $HOME/dead.letter unmailable text SEE ALSO biff(1), login(1), mailx(1), uucp(1C), write(1). 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. April, 1990 3