mail - ProLine mail


mail [ -m mbox ]
mail [ -n ]
mail [ -s ] user …


Mail is an interactive electronic mail management system that lets you send, receive, and store messages. Because of its interactive nature, mail is best learned by use. To invoke mail, use any of the following examples:


Reads messages in your mailbox.

mail -m letters

Reads messages in the file “letters”.

mail -n

This flag causes mail to display “No new mail” and exit if your mailbox has not been changed since the last time you read mail.

mail user

Sends mail to “user”.

mail -s

Mail prompts you for the name of a user to send to.

The command levels in mail respond to single-key abbreviations for command names. They are expanded for you automatically. A list of available commands is displayed by typing a “?” at any prompt.

Upon entering mail, the mailbox will be scanned for all your messages. A report is then listed which shows various information about each message, including the sender’s name and the subject.

Reading Mail

mail recognizes the following interactive commands at the mail> prompt. To invoke a command, enter the first letter of its name:


Pressing the RETURN or SPACE keys advances you to the next message, and displays it. (Displays the first message if none have been read.)


Marks the current message for deletion, then displays the next message. (Displays the first message if none have been read.)


Displays the previous message.

Type <msgs>

Displays the selected messages. The “current message” number will be set to the last message printed.


Displays the current message.

Headers <msgs>

Prints a one-line header for the selected messages. The header contains: a ‘*’ if that message is marked for deletion, the number of the message, the number of characters in the message, the sender’s name, and the subject.


Lists headers for all the messages (same as Headers All).


Sends a message. You are asked to fill in the “To:” field with the name of the recipient (enter nothing at all to cancel), and the subject of the message. You may then start typing the body of your message. (see Sending Mail below for more details)

Forward <msgs>

Forwards selected messages to others. You address the message as with Send above, and then enter some introductory comments of your own which will appear at the start of the message. Once you leave text entry mode, the forwarded message is appended into the outgoing message.

Reply to <msg>

Sends a reply to a message. mail fills in the “To:”, and “Subject:” lines of your reply. You have the option of entering the addresses for additional recipients (if any) in order to send “carbon copies” (Cc:).

Delete <msgs>

Marks selected messages for deletion when quitting. Messages marked for deletion will have a ‘*’ after their number in their header. Deletion marks may be removed with the Undelete command. Note: this only marks messages to be deleted later. Marked letters are still accessible until you Quit.

Undelete <msgs>

Removes the deletion marks for the selected messages.

Write <msgs>

Writes the selected messages to a file. If the target file exists, you are asked if the messages should overwrite it or be appended to it.


Views a file from disk.


Allows you to edit a file while working in mail.

$ Edit Vars

Invokes the editor on your “mailrc” file which defines variables that you may use with mail. (See Variables below for details.)

! Shell Command

Executes a command line you enter at the “!” prompt. Commands can be anything that can be executed in a normal command line shell, including invoking an interactive shell (csh -c for example). When the command is completed, you can continue to enter additional commands at the “!” prompt, or press Enter to return to the current prompt in mail.


Opens a new mailbox, allowing you to close the current one. If the current mailbox has messages marked for deletion, you are asked to confirm their removal before the new mailbox is opened and processed.


Quits mail. You are asked to confirm the removal of any messages marked for deletion before quitting.

? (help)

Shows a list of all the available commands.

The <msgs> argument to some commands may be one of the following:

All All of the messages in the current mailbox

Current Last message typed (same as RETURN)

Next Next message (current message + 1)

Previous Previous message (current message - 1)

First Message number 1 (the oldest message)

Last The highest numbered (most recent) message

Or <msgs> may be a list of numbers, as in these examples:

2 message 2

11-15 messages 11 through 15 (inclusive)

-15 first message through message 15

3- message 3 through the last message

Special Keys

All command levels in mail support the + and - keys which turn the —More— prompt on and off, respectively. Additionally, the mail> and send> prompts allow you to type in a number (or numeric range) to display the specified messages from your mailbox. Using the “;” key at any command prompt will list the headers of all messages in your mailbox (same as the List command at the mail> prompt).

Mail Strategy

Here’s a strategy for reading and processing your mail efficiently using mail. Upon entering mail, examine the report of your messages to get an idea of the kind of mail you have, the sizes of various messages, and whether or not there are any which require immediate attention.

If you don’t have any urgent messages, you can read each in turn with the Next command. Once a message has been displayed, it is referred to as the “current” message. You can reply to the current message with the command “Reply to Current”; this begins an outgoing message in response to the message you’ve just read.

Using Next automatically marks the current message for deletion, and then proceeds to display the next message. If you press RETURN or SPACE to advance to the next message, the status of the current message is not affected. You can, however, mark any message to be deleted later with the “Delete” command. You may also want to proceed to the next one. If you want to read a message out of order, use the “Type” command followed by the number of the message and a RETURN. Or, you can simply type in the message’s number (or a range) at any prompt, followed by a RETURN.

In general, it is easier to deal with each message one at a time, as you read it, although some people like to read all of their mail first, then go back and delete and/or store away some of their messages.

When you are ready to leave mail, use the “Quit” command. If you have marked any messages for deletion, you will be asked if you actually want them permanently removed. You may save a message marked for deletion at any time with the “Undelete” command.

Sending Mail

Mail lets you send a message to one or more users on your local site, as well as to users on distant sites on the network. To address a local message, you provide the user’s account name (not the user’s actual name). You can specify a group of names (each separated by a space) in order to send a single message to multiple users. Network mail addresses can be entered using the “user@site” or “site!user” syntaxes.

After entering the address of the message, you are asked to fill in the “Subject:” field. Then, you’ll be placed in text entry mode. Anything you type that does not start with your exit character (usually a period “.”) is added to the body of your letter. Word wrapping occurs at column 75. To exit text entry, type the exit character at the beginning of a new line followed by RETURN.

The following interactive commands are recognized at the send> prompt, as well as from text entry mode by prefixing them with the exit character (i.e., “.s” is the same as typing “s” from the send> command prompt).


Continues to add text at the end of your message.


Lists the header and body of your message.


Calls up the editor for use with your message. After saving your editing changes, you’ll be returned to the send> prompt for further commands.

Include <msgs>

Includes the bodies of the specified messages from your mailbox into the message, prefixing each line with the prefix character as defined in the $prefix variable (usually the > symbol).

Headers … <msgs>

Same as Include above, but it includes the header and body portions of messages.

Forward <msgs>

Includes the header and body of the specified messages without formatting.


Gets a file from disk and appends it to the end of the message.


Sends the message to all the specified recipients. If any outgoing network addresses were specified, the file named signature, if it exists in your home directory, is appended to the end of the message.


Modifies the To, Subject, Cc, and Bcc fields in the header of your message.


Specifies the target recipient (To) addresses.


Specifies a Reply-To address for when the recipient of the letter generates a reply, the reply will be sent to the address in this field instead of the original author of the message.


Specifies “carbon copy” (Cc) addresses.


Specifies “blind carbon copy” (Bcc) addresses. These are like Cc’s, but only the users in the “Bcc:” field will be aware that they received copies of your message. The recipients in the “To:” and “Cc:” fields will not be aware that additional copies were sent.


Views a file.


Writes the body of your message to a file (with the option of to include the header).

$ Edit Vars

Allows you to edit or peruse your variables. (See Variables below for details.)

! Shell Command

Execute a command line. earlier).


Opens a new mailbox.


Quits without sending the message.

Messages are not actually delivered until you log off the system or issue the sendmail command from the C-Shell.


Mail accepts variables as shortcuts for lengthy or hard to remember input. A variable is a keyword that begins with a dollar-sign ($), such as $prompt. When used in areas where text arguments are supplied, the values of these variables are inserted (except in text input mode and the “Subject:” field of outgoing messages). Variables can also be used to control and customize the behavior of mail.

Some variables are defined for you automatically:


Contains the system’s startup prefix. (Cannot be deleted)


If set to 1 (default), mail attaches your “signature” file to messages you send.


If set to 1 (default), you’re asked if you want to include all recipients in the carbon-copy field of outgoing messages.


Controls the clearing of the screen at various points in mail. If set to 0, disables any screen clearing. If set to 1 (the default), mail will clear the screen upon entry and before any list, file, or message is displayed.


Keeps track of the current message between sessions. Delete this variable to disable this feature.


The character used to mark deleted messages, usually “*”.


If this variable is not defined or empty, your preferred editor will be invoked for message input. By setting the escape variable to any character, mail uses its built-in input mode for message composition. (You can still invoke your editor later). The built-in editor accepts one line of input at a time, until you enter a line that contains only the character stored in the escape variable, which lets you “escape” from input mode. Escape sequences may include one extra character which causes mail to exit input mode and act on the next character as if it were entered at the send> prompt. The default escape is ‘.’, causing mail to use the built-in input mode.


The path to your home directory. (Cannot be deleted)


This variable should not be changed. It is maintained by mail to keep track of the last time you read any mail. Its purpose is to hold the date and time (in a special decimal format) for use with the -n flag when mail is invoked.


The path to your incoming mailbox. (Cannot be deleted)


Controls exiting from mail if the mailbox is empty. If set to 0, invoking mail with an empty mailbox leaves you at the mail> prompt. If set to 1, an empty mailbox causes mail to report, “No mail,” and then quits.


Holds the name of the user’s organization that is placed into the Organization: field of outgoing messages.


This character (or string) is displayed for each new line of input while in built-in text input mode. (See escape).


This character (or string) is used to “quote” each line included from your mailbox into a reply.


Holds an address that is placed into the Reply-To: field of outgoing messages.


Controls the display of the message summary after entering mail. If set to 0, no summary is displayed. If set to 1 (the default), a summary of all messages in your mailbox is shown. If set to 2, a summary of only the current message to the last is shown.


If set to 1 causes messages written to a file to be marked for deletion. (default is 0)

The dollar-sign ($) introduces each variable used as input. If you wanted to write a message to a file, you could enter:

mail> Write Current
to file: $home/tempfile

mail sees $home and substitutes it for the path to your home directory, saving you a few keystrokes.

Another example: You regularly correspond with a group of writers. Typing in all the names is a tedious task. Instead, you create a variable to make life much simpler. Let’s say you’ve created your own variable called “writers” in your mailrc file:

writers=brock ryan dang rlouv davew

To use it, follow this scenario:

mail> Send
To: $writers

Mail replaces your variable with its value, which actually ends up addressing the message like so:

To: brock ryan dang rlouv davew

Variables can be used to substitute any part of a pathname, address, or filename. They’re not case-sensitive, and can reference other variables.


variable assignments,
signature file,
prevents sending offsite mail.

See Also

sendmail(C), rcp(NET)


Morgan Davis