Documented in Volume 1 of the UNIX Programmers Manual.
% mail
is for reading mail; issues a message telling whether or not you have mail.
If you do, it is listed like this:
"/usr/spool/mail/kemp": 2 messages
> 1 NIC@SRI-NIC Mon Mar 28 16:13 36/1334 "Network Newsletter No. 22"
2 NIC@SRI-NIC Mon Mar 28 16:47 36/1334 "Network Newsletter No. 23"
&
and you enter an interactive mail session. The ampersand is mail's
solicit character. Use x to get out without changing anything;
use ? for help. The > points to the current message (#1 in this case).
% mail smith
is for sending mail; interactively solicits you to fill in the blanks of
a letter (Subject, etc.) to the addressee with a login name of "smith".
Use ~v to invoke vi, ~h to see and modify header lines.
Terminate with a CTRL-D, and abort with DELETE.
% from
is a quick, non-committal way to see what is in your incoming mailbox.
It lists a line per message of from: and date: header lines.
% mail -f filename
will cause mail to use filename as the "in box" rather than
/usr/spool/mail/.
% mail -s "A subject line" kemp < filex
will send user kemp mail (taken from the file filex) with a Subject:
line of "A subject line"
% mail -d
will fire up mail with the debug option set; this will show everything
that mail knows about you and your files, as well as list commands that
mail generates.
From: dave@lsuc.UUCP (David Sherman)
If you're using Berkeley Mail, and you want your cc to go into
a file rather than to a user (such as yourself, if all you'll do
then is save it in a file), put in the file name with a /, e.g.
Cc: mail/joe
If you want it to go into a file in your current directory, use
Cc: ./joe
All this is documented, but some people may not have known about it.
When mailing, the following ~ escapes are defined:
~~ Quote a single tilde
~c users Add users to cc list
~d Read in dead.letter
~e Edit the message buffer
~f message(s) Read the named messages(s) into the message buffer.
If no message named, use current message
~h Prompt for to list, subject and cc list
This is how you set the bcc (blind-carbon) addressee.
~r file Read a file into the message buffer
~p Print the message buffer
~m message(s) Read in messages, right shifted by a tab
~s subject Set subject
~t users Add users to to list
~v Invoke display editor on message
~w file Write message onto file
~? Print this message
~!command Invoke the shell
~|command Pipe the message through the command
See also biff.
See /usr/doc/mail/ on 4.2 BSD systems for additional online documentation on this.