Name

mail

Synopsis

mail [options] [users]

Description

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.

Get Linux in a Nutshell, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.