-->
Previous Table of Contents Next


Getting Help with mail

When you type the command to start your e-mail program, you see a ? prompt. The mail program tells you to type ? for help. To get a list of commands and some information about each command, type ? and press <Return>.

After you type ? and press <Return>, you see a display similar to the following:


Mail   Commands

t <message list>     type messages

n               goto and type next message

e <message list>     edit messages

f <message list>     give head lines of messages

d <message list>     delete messages

s <message list>      file append messages to file

u <message list>     undelete messages

R <message list>     reply to message senders

r <message list>     reply to message senders and all recipients

pre <message list>     make messages go back to /usr/spool/mail

p <message list>     print message

m <user list>          mail to specific users

q               quit, saving unresolved messages in mbox

x               quit, do not remove system mailbox

h               print out active message headers

!               shell escape

cd [directory]     chdir to directory or home if none given

A <message list> consists of integers, ranges of same, or user names

separated by spaces. If omitted, Mail uses the last message typed.

A <user list> consists of user names or aliases separated by spaces.

Aliases are defined in .mailrc in your home directory.

&

This listing shows you the commands you can use from the ? prompt. Although some of these commands are explained later in this chapter, here are some things to note right now:

  In each case, you can use the first letter of the command or type the entire command.
  Items in [] and <> are optional; you don’t type the brackets as part of the command.
  You can make the term message list refer to all messages by using *. To save all messages in a file named allmail, for example, type s * allmail and press <Return>.
  You can make the term message list refer to a single message number. To save message number 2 to a file named meeting, for example, type s 2 meeting and press <Return>.
  You can make the term message list refer to a range of message numbers by separating the two message numbers with a hyphen. For example, 2-4 refers to messages numbered 2, 3, and 4. To save messages 2, 3, and 4 in a file named memos, type s 2-4 memos and press <Return>.
  The term print in the line print message doesn’t mean to print messages on a printer. It means to display the messages.
  The edit command is useful for modifying messages before forwarding them to someone else or saving them in a file.

Saving E-Mail to Files with mail

You’ll want to save some of the e-mail you receive. It’s not practical to keep all your mail in your system mailbox for these reasons:

  You’ll have too many messages to wade through when you want to read your mail.
  System administrators often limit the size of your system mailbox. This size limit depends on how your system administrator set it up. If you reach that limit, you may be prevented from receiving any new mail.
  Your mail won’t be organized, and it can be difficult to find important messages or all messages relating to a specific project or topic.

Earlier in this chapter, you learned that the messages you’ve read are saved (unless you say otherwise) in the file mbox. You also know that you can read these messages by typing mail -f mbox and pressing <Return>. You can also read messages from other files by using the mail command’s -f option.

There are two primary ways (with and without a header) to save the current message in a file when you use mail. With both methods, you can specify a file to hold the message, and the message is added to that file. If you don’t specify a file, the message is added to the file mbox (your personal mailbox) in your home directory. If you use q to quit the mail program, the messages are removed from your system mailbox.

When you see the ? prompt, you can use any of the following methods to save a message:

  Type s to add the current message to mbox in your home directory.
  Type s filename to add the text of the current message to the named file with the headers intact (useful if you want to use your e-mail program to read the messages later).
  Type w filename to add the text of the current message to the named file without the header information (useful when you want to use only the text of the messages in a file that may be processed by some other program).


TIP:  To keep messages in your system mailbox rather than the mbox file after you read them, use the preserve command, pre. You can use this command with a message list.

You know that messages you’ve already read are automatically saved to mbox unless you use the preserve command.

It’s a good idea to get in the habit of specifying a filename when you use the save command, s. If you don’t specify a filename, the current message is added to the file mbox. If you include a message list but don’t specify a file, mail uses the message list as the name of the file to which it saves the current message. If you use q to quit the e-mail program, the saved messages are removed from your system mailbox.


Previous Table of Contents Next