mail [options] [users]
Read
mail or send mail to other users. The mail
utility allows you to compose, send, receive, forward, and reply to mail. mail
has two main modes: compose mode, in which you create a message, and command
mode, in which you manage your mail.
While mail
is a powerful utility, it can be tricky for a novice user. Most Linux distributions
include pine and elm, which are much easier to use.
This
section presents mail commands, options, and files. To get you
started, here are two of the most basic commands.
To
enter interactive mail-reading mode, type:
mail
To
begin writing a message to user, type:
mail user
Enter
the text of the message, one line at a time, pressing Enter at the end of
each line. To end the message, enter a single period ( )
in the first column of a new line, and press Enter.
Command-line options
-b list
Set blind carbon copy field
to comma-separated list.
-c list
Set carbon copy field to
comma-separated list.
-d
Print debugging information.
-f [file
Process contents of file,
instead of /var/spool/mail/$user. If file
is omitted, process mbox in the user's home
directory.
-i
Do not respond to tty
interrupt signals.
-n
Do not consult /etc/mail.rc
when starting up.
-p
Read mail in POP mode.
-s subject
Set subject to subject.
-u
Process contents of /var/spool/mail/$user.
Default.
-v
Verbose. Print information
about mail delivery to standard out.
-I
Interactive -- even when
standard input has been redirected from the terminal.
-N
When printing a mail message
or entering a mail folder, do not display message headers.
-P
Disable POP mode.
Compose-mode commands
Execute a shell escape from
compose mode.
List compose mode escapes.
~b names
Add names to or edit the Bcc:
header.
~c names
Add names to or edit the Cc:
header.
~d
Read in the dead.letter
file.
~e
Invoke text editor.
~f messages
Insert messages
into message being composed.
~F messages
Similar to ~f, but
include message headers.
~h
Add to or change all the
headers interactively.
~m messages
Similar to ~f, but
indent with a tab.
~M messages
Similar to ~m, but
include message headers.
~p
Print message header fields
and message being sent.
~q
Abort current message
composition.
~r filename
Append file to current
message.
~s string
Change Subject:
header to string.
~t names
Add names to or edit the To
list.
~v
Invoke editor specified with
the VISUAL environment variable.
command
Pipe message through command.
mail-command
Execute mail-command.
string
Insert string
in text of message, prefaced by a single tilde (~). If string contains a ~,
it must be escaped with a .
Command-mode commands
|
List summary of commands (help
screen).
|
|
Execute a shell command.
|
num
|
Print numth previous
message; defaults to immediately previous.
|
alias (a)
|
Print or create alias lists.
|
alternates (alt)
|
Specify remote accounts on remote machines
that are yours. Tell mail not to reply to them.
|
chdir (c)
|
cd to home or specified directory.
|
copy (co)
|
Similar to save, but do not mark
message for deletion.
|
delete (d)
|
Delete message.
|
dp
|
Delete current message and display next one.
|
edit (e)
|
Edit message.
|
exit (ex, x)
|
Exit mail without
updating folder.
|
file (fi)
|
Switch folders.
|
folder (fold)
|
Read messages saved in a file. Files can be:
|
|
Previous
|
|
System mailbox
|
|
user user's system mailbox
|
|
& mbox
|
|
folder File in folder
directory.
|
folders
|
List folders.
|
headers (h)
|
List message headers at
current prompt.
|
headers+ (h+)
|
Move forward one window of
headers.
|
headers- (h-)
|
Move back one window of
headers.
|
help
|
Same as ?.
|
hold (ho)
|
Hold messages in system
mailbox.
|
ignore
|
Append list of fields to ignored
fields.
|
mail user (m)
|
Compose message to user.
|
mbox
|
Default. Move specified messages to mbox
on exiting.
|
next (n)
|
Type next message or next message that matches
argument.
|
preserve (pr)
|
Synonym for hold.
|
print list] (p)
|
Display each message in list
|
Print list] (P)
|
Similar to print, but
include header fields.
|
quit (q)
|
Exit mail and update
folder.
|
reply (r)
|
Send mail to all on
distribution list.
|
Reply (R)
|
Send mail to author only.
|
respond
|
Same as reply.
|
retain
|
Always include this list of header fields when
printing messages. With no arguments, list retained fields.
|
save (s)
|
Save message to folder.
|
saveignore
|
Remove ignored fields when
saving.
|
saveretain
|
Override saveignore to retain specified
fields.
|
set (se)
|
Set or print mail
options.
|
shell (sh)
|
Enter a new shell.
|
size
|
Print size of each specified
message.
|
source
|
Read commands from specified
file.
|
top
|
Print first few lines of each specified
message.
|
type (t)
|
Same as print.
|
Type (T)
|
Same as Print.
|
unalias
|
Discard previously defined aliases.
|
undelete (u)
|
Restore deleted message.
|
unread (U)
|
Mark specified messages as
unread.
|
unset (uns)
|
Unset mail options.
|
visual (v)
|
Edit message with editor specified by the
VISUAL environment variable.
|
write (w)
|
Write message, without header,
to file.
|
xit (x)
|
Same as exit.
|
z
|
Move mail's attention to next windowful
of text. Use z- to move it back.
|
mail options
These
options are used inside of the .mailrc file. The syntax
is set option or unset option.
append
|
Append (do not prepend) messages to mbox.
|
ask
|
Prompt for subject.
|
askbcc
|
Prompt for blind carbon copy recipients.
|
askcc
|
Prompt for carbon copy recipients.
|
asksub
|
Prompt for Subject line.
|
autoprint
|
Print next message after a delete.
|
chron
|
Display messages in chronological order, most
recent last.
|
debug
|
Same as -d on command line.
|
dot
|
Interpret a solitary . as an EOF.
|
folder
|
Define directory to hold mail folders.
|
hold
|
Keep message in system mailbox upon quitting.
|
ignore
|
Ignore interrupt signals from terminal. Print
them as @.
|
ignoreeof
|
Do not treat ^D as an EOF.
|
metoo
|
Do not remove sender from groups when mailing
to them.
|
noheader
|
Same as -N on command line.
|
nokerberos
|
Retrieve POP mail via POP3, not KPOP,
protocol.
|
nosave
|
Do not save aborted letters to dead.letter.
|
pop-mail
|
Retrieve mail with POP3 protocol, and save it
in mbox.pop.
|
prompt
|
Set prompt to a different string.
|
Replyall
|
Switch roles of Reply and reply.
|
quiet
|
Do not print version at startup.
|
searchheaders
|
When given the specifier /x:y,
expand all messages that contain the string y
in the x header field.
|
verbose
|
Same as -v on command line.
|
verbose-pop
|
Display status while retrieving POP mail.
|
Special files
calendar
|
Contains reminders that the operating system
mails to you.
|
.maildelivery
|
Mail delivery configuration file.
|
.mailrc
|
Mail configuration file.
|
triplog
|
Keeps track of your automatic response
recipients.
|
tripnote
|
Contains automatic message.
|
|