MAIL REFERENCE MANUAL _K_u_r_t _S_h_o_e_n_s Revised by _C_r_a_i_g _L_e_r_e_s Version 2.18 May 13, 1987 _1. _I_n_t_r_o_d_u_c_t_i_o_n _M_a_i_l provides a simple and friendly environment for sending and receiving mail. It divides incoming mail into its constituent messages and allows the user to deal with them in any order. In addition, it provides a set of _e_d- like commands for manipulating messages and sending mail. _M_a_i_l offers the user simple editing capabilities to ease the composition of outgoing messages, as well as providing the ability to define and send to names which address groups of users. Finally, _M_a_i_l is able to send and receive messages across such networks as the ARPANET, UUCP, and Berkeley net- work. This document describes how to use the _M_a_i_l program to send and receive messages. The reader is not assumed to be familiar with other message handling systems, but should be familiar with the UNIX[1] shell, the text editor, and some ____________________ 99 [1] UNIX is a trademark of Bell Laboratories. Mail Reference Manual 5/13/87 2 of the common UNIX commands. "The UNIX Programmer's Manual," "An Introduction to Csh," and "Text Editing with Ex and Vi" can be consulted for more information on these topics. Here is how messages are handled: the mail system accepts incoming _m_e_s_s_a_g_e_s for you from other people and col- lects them in a file, called your _s_y_s_t_e_m _m_a_i_l_b_o_x. When you login, the system notifies you if there are any messages waiting in your system mailbox. If you are a _c_s_h user, you will be notified when new mail arrives if you inform the shell of the location of your mailbox. On version 7 sys- tems, your system mailbox is located in the directory /usr/spool/mail in a file with your login name. If your login name is "sam," then you can make _c_s_h notify you of new mail by including the following line in your .cshrc file: set mail=/usr/spool/mail/sam When you read your mail using _M_a_i_l, it reads your system mailbox and separates that file into the individual messages that have been sent to you. You can then read, reply to, delete, or save these messages. Each message is marked with its author and the date they sent it. 9 9 Mail Reference Manual 5/13/87 3 _2. _C_o_m_m_o_n _u_s_a_g_e The _M_a_i_l command has two distinct usages, according to whether one wants to send or receive mail. Sending mail is simple: to send a message to a user whose login name is, say, "root," use the shell command: % Mail root then type your message. When you reach the end of the mes- sage, type an EOT (control-d) at the beginning of a line, which will cause _M_a_i_l to echo "EOT" and return you to the Shell. When the user you sent mail to next logs in, he will receive the message: You have mail. to alert him to the existence of your message. If, while you are composing the message you decide that you do not wish to send it after all, you can abort the letter with a RUBOUT. Typing a single RUBOUT causes _M_a_i_l to print (Interrupt -- one more to kill letter) Typing a second RUBOUT causes _M_a_i_l to save your partial letter on the file "dead.letter" in your home directory and abort the letter. Once you have sent mail to someone, there is no way to undo the act, so be careful. The message your recipient reads will consist of the message you typed, preceded by a line telling who sent the message (your login name) and the date and time it was sent. If you want to send the same message to several other people, you can list their login names on the command line. Thus, % Mail sam bob john Tuition fees are due next Friday. Don't forget!! EOT % will send the reminder to sam, bob, and john. If, when you log in, you see the message, You have mail. you can read the mail by typing simply: 9 9 Mail Reference Manual 5/13/87 4 % Mail _M_a_i_l will respond by typing its version number and date and then listing the messages you have waiting. Then it will type a prompt and await your command. The messages are assigned numbers starting with 1 -- you refer to the mes- sages with these numbers. _M_a_i_l keeps tack of which messages are _n_e_w (have been sent since you last read your mail) and _r_e_a_d (have been read by you). New messages have an _N next to them in the header listing and old, but unread messages have a _U next to them. _M_a_i_l keeps track of new/old and read/unread messages by putting a header field called "Status" into your messages. To look at a specific message, use the _t_y_p_e command, which may be abbreviated to simply _t. For example, if you had the following messages: N 1 root Wed Sep 21 09:21 "Tuition fees" N 2 sam Tue Sep 20 22:55 you could examine the first message by giving the command: type 1 which might cause _M_a_i_l to respond with, for example: Message 1: From root Wed Sep 21 09:21:45 1978 Subject: Tuition fees Status: R Tuition fees are due next Wednesday. Don't forget!! Many _M_a_i_l commands that operate on messages take a message number as an argument like the _t_y_p_e command. For these com- mands, there is a notion of a current message. When you enter the _M_a_i_l program, the current message is initially the first one. Thus, you can often omit the message number and use, for example, t to type the current message. As a further shorthand, you can type a message by simply giving its message number. Hence, 1 would type the first message. 9 9 Mail Reference Manual 5/13/87 5 Frequently, it is useful to read the messages in your mailbox in order, one after another. You can read the next message in _M_a_i_l by simply typing a newline. As a special case, you can type a newline as your first command to _M_a_i_l to type the first message. If, after typing a message, you wish to immediately send a reply, you can do so with the _r_e_p_l_y command. _R_e_p_l_y, like _t_y_p_e, takes a message number as an argument. _M_a_i_l then begins a message addressed to the user who sent you the mes- sage. You may then type in your letter in reply, followed by a at the beginning of a line, as before. _M_a_i_l will type EOT, then type the ampersand prompt to indi- cate its readiness to accept another command. In our exam- ple, if, after typing the first message, you wished to reply to it, you might give the command: reply _M_a_i_l responds by typing: To: root Subject: Re: Tuition fees and waiting for you to enter your letter. You are now in the message collection mode described at the beginning of this section and _M_a_i_l will gather up your message up to a control-d. Note that it copies the subject header from the original message. This is useful in that correspondence about a particular matter will tend to retain the same sub- ject heading, making it easy to recognize. If there are other header fields in the message, the information found will also be used. For example, if the letter had a "To:" header listing several recipients, _M_a_i_l would arrange to send your replay to the same people as well. Similarly, if the original message contained a "Cc:" (carbon copies to) field, _M_a_i_l would send your reply to _t_h_o_s_e users, too. _M_a_i_l is careful, though, not too send the message to _y_o_u, even if you appear in the "To:" or "Cc:" field, unless you ask to be included explicitly. See section 4 for more details. After typing in your letter, the dialog with _M_a_i_l might look like the following: reply To: root Subject: Tuition fees Thanks for the reminder EOT & 9 9 Mail Reference Manual 5/13/87 6 The _r_e_p_l_y command is especially useful for sustaining extended conversations over the message system, with other "listening" users receiving copies of the conversation. The _r_e_p_l_y command can be abbreviated to _r. Sometimes you will receive a message that has been sent to several people and wish to reply _o_n_l_y to the person who sent it. _R_e_p_l_y with a capital _R replies to a message, but sends a copy to the sender only. If you wish, while reading your mail, to send a message to someone, but not as a reply to one of your messages, you can send the message directly with the _m_a_i_l command, which takes as arguments the names of the recipients you wish to send to. For example, to send a message to "frank," you would do: mail frank This is to confirm our meeting next Friday at 4. EOT & The _m_a_i_l command can be abbreviated to _m. Normally, each message you receive is saved in the file _m_b_o_x in your login directory at the time you leave _M_a_i_l. Often, however, you will not want to save a particular mes- sage you have received because it is only of passing interest. To avoid saving a message in _m_b_o_x you can delete it using the _d_e_l_e_t_e command. In our example, delete 1 will prevent _M_a_i_l from saving message 1 (from root) in _m_b_o_x. In addition to not saving deleted messages, _M_a_i_l will not let you type them, either. The effect is to make the mes- sage disappear altogether, along with its number. The _d_e_l_e_t_e command can be abbreviated to simply _d. Many features of _M_a_i_l can be tailored to your liking with the _s_e_t command. The _s_e_t command has two forms, depending on whether you are setting a _b_i_n_a_r_y option or a _v_a_l_u_e_d option. Binary options are either on or off. For example, the "ask" option informs _M_a_i_l that each time you send a message, you want it to prompt you for a subject header, to be included in the message. To set the "ask" option, you would type set ask Another useful _M_a_i_l option is "hold." Unless told oth- erwise, _M_a_i_l moves the messages from your system mailbox to Mail Reference Manual 5/13/87 7 the file _m_b_o_x in your home directory when you leave _M_a_i_l. If you want _M_a_i_l to keep your letters in the system mailbox instead, you can set the "hold" option. Valued options are values which _M_a_i_l uses to adapt to your tastes. For example, the "SHELL" option tells _M_a_i_l which shell you like to use, and is specified by set SHELL=/bin/csh for example. Note that no spaces are allowed in "SHELL=/bin/csh." A complete list of the _M_a_i_l options appears in section 5. Another important valued option is "crt." If you use a fast video terminal, you will find that when you print long messages, they fly by too quickly for you to read them. With the "crt" option, you can make _M_a_i_l print any message larger than a given number of lines by sending it through the paging program _m_o_r_e. For example, most CRT users should do: set crt=24 to paginate messages that will not fit on their screens. _M_o_r_e prints a screenful of information, then types --MORE--. Type a space to see the next screenful. Another adaptation to user needs that _M_a_i_l provides is that of _a_l_i_a_s_e_s. An alias is simply a name which stands for one or more real user names. _M_a_i_l sent to an alias is really sent to the list of real users associated with it. For example, an alias can be defined for the members of a project, so that you can send mail to the whole project by sending mail to just a single name. The _a_l_i_a_s command in _M_a_i_l defines an alias. Suppose that the users in a project are named Sam, Sally, Steve, and Susan. To define an alias called "project" for them, you would use the _M_a_i_l command: alias project sam sally steve susan The _a_l_i_a_s command can also be used to provide a convenient name for someone whose user name is inconvenient. For exam- ple, if a user named "Bob Anderson" had the login name "anderson,"" you might want to use: alias bob anderson so that you could send mail to the shorter name, "bob." While the _a_l_i_a_s and _s_e_t commands allow you to customize _M_a_i_l, they have the drawback that they must be retyped each time you enter _M_a_i_l. To make them more convenient to use, Mail Reference Manual 5/13/87 8 _M_a_i_l always looks for two files when it is invoked. It first reads a system wide file "/usr/lib/Mail.rc," then a user specific file, ".mailrc," which is found in the user's home directory. The system wide file is maintained by the system administrator and contains _s_e_t commands that are applicable to all users of the system. The ".mailrc" file is usually used by each user to set options the way he likes and define individual aliases. For example, my .mailrc file looks like this: set ask nosave SHELL=/bin/csh As you can see, it is possible to set many options in the same _s_e_t command. The "nosave" option is described in sec- tion 5. Mail aliasing is implemented at the system-wide level by the mail delivery system _s_e_n_d_m_a_i_l. These aliases are stored in the file /usr/lib/aliases and are accessible to all users of the system. The lines in /usr/lib/aliases are of the form: alias: name<1>, name<2>, name<3> where _a_l_i_a_s is the mailing list name and the _n_a_m_e<_i> are the members of the list. Long lists can be continued onto the next line by starting the next line with a space or tab. Remember that you must execute the shell command _n_e_w_a_l_i_a_s_e_s after editing /usr/lib/aliases since the delivery system uses an indexed file created by _n_e_w_a_l_i_a_s_e_s. We have seen that _M_a_i_l can be invoked with command line arguments which are people to send the message to, or with no arguments to read mail. Specifying the -f flag on the command line causes _M_a_i_l to read messages from a file other than your system mailbox. For example, if you have a col- lection of messages in the file "letters" you can use _M_a_i_l to read them with: % Mail -f letters You can use all the _M_a_i_l commands described in this document to examine, modify, or delete messages from your "letters" file, which will be rewritten when you leave _M_a_i_l with the _q_u_i_t command described below. Since mail that you read is saved in the file _m_b_o_x in your home directory by default, you can read _m_b_o_x in your home directory by using simply % Mail -f 9 9 Mail Reference Manual 5/13/87 9 Normally, messages that you examine using the _t_y_p_e com- mand are saved in the file "mbox" in your home directory if you leave _M_a_i_l with the _q_u_i_t command described below. If you wish to retain a message in your system mailbox you can use the _p_r_e_s_e_r_v_e command to tell _M_a_i_l to leave it there. The _p_r_e_s_e_r_v_e command accepts a list of message numbers, just like _t_y_p_e and may be abbreviated to _p_r_e. Messages in your system mailbox that you do not examine are normally retained in your system mailbox automatically. If you wish to have such a message saved in _m_b_o_x without reading it, you may use the _m_b_o_x command to have them so saved. For example, mbox 2 in our example would cause the second message (from sam) to be saved in _m_b_o_x when the _q_u_i_t command is executed. _M_b_o_x is also the way to direct messages to your _m_b_o_x file if you have set the "hold" option described above. _M_b_o_x can be abbreviated to _m_b. When you have perused all the messages of interest, you can leave _M_a_i_l with the _q_u_i_t command, which saves the mes- sages you have typed but not deleted in the file _m_b_o_x in your login directory. Deleted messages are discarded irre- trievably, and messages left untouched are preserved in your system mailbox so that you will see them the next time you type: % Mail The _q_u_i_t command can be abbreviated to simply _q. If you wish for some reason to leave _M_a_i_l quickly without altering either your system mailbox or _m_b_o_x, you can type the _x command (short for _e_x_i_t), which will immediately return you to the Shell without changing anything. If, instead, you want to execute a Shell command without leaving _M_a_i_l, you can type the command preceded by an exclamation point, just as in the text editor. Thus, for instance: !date will print the current date without leaving _M_a_i_l. Finally, the _h_e_l_p command is available to print out a brief summary of the _M_a_i_l commands, using only the single character command abbreviations. 9 9 Mail Reference Manual 5/13/87 10 _3. _M_a_i_n_t_a_i_n_i_n_g _f_o_l_d_e_r_s _M_a_i_l includes a simple facility for maintaining groups of messages together in folders. This section describes this facility. To use the folder facility, you must tell _M_a_i_l where you wish to keep your folders. Each folder of messages will be a single file. For convenience, all of your folders are kept in a single directory of your choosing. To tell _M_a_i_l where your folder directory is, put a line of the form set folder=letters in your ._m_a_i_l_r_c file. If, as in the example above, your folder directory does not begin with a `/,' _M_a_i_l will assume that your folder directory is to be found starting from your home directory. Thus, if your home directory is /_u_s_r/_p_e_r_s_o_n the above example told _M_a_i_l to find your folder directory in /_u_s_r/_p_e_r_s_o_n/_l_e_t_t_e_r_s. Anywhere a file name is expected, you can use a folder name, preceded with `+.' For example, to put a message into a folder with the _s_a_v_e command, you can use: save +classwork to save the current message in the _c_l_a_s_s_w_o_r_k folder. If the _c_l_a_s_s_w_o_r_k folder does not yet exist, it will be created. Note that messages which are saved with the _s_a_v_e command are automatically removed from your system mailbox. In order to make a copy of a message in a folder without causing that message to be removed from your system mailbox, use the _c_o_p_y command, which is identical in all other respects to the _s_a_v_e command. For example, copy +classwork copies the current message into the _c_l_a_s_s_w_o_r_k folder and leaves a copy in your system mailbox. The _f_o_l_d_e_r command can be used to direct _M_a_i_l to the contents of a different folder. For example, folder +classwork directs _M_a_i_l to read the contents of the _c_l_a_s_s_w_o_r_k folder. All of the commands that you can use on your system mailbox are also applicable to folders, including _t_y_p_e, _d_e_l_e_t_e, and _r_e_p_l_y. To inquire which folder you are currently editing, use simply: 9 9 Mail Reference Manual 5/13/87 11 folder To list your current set of folders, use the _f_o_l_d_e_r_s command. To start _M_a_i_l reading one of your folders, you can use the -_f option described in section 2. For example: % Mail -f +classwork will cause _M_a_i_l to read your _c_l_a_s_s_w_o_r_k folder without look- ing at your system mailbox. 9 9 Mail Reference Manual 5/13/87 12 _4. _M_o_r_e _a_b_o_u_t _s_e_n_d_i_n_g _m_a_i_l _4._1. _T_i_l_d_e _e_s_c_a_p_e_s While typing in a message to be sent to others, it is often useful to be able to invoke the text editor on the partial message, print the message, execute a shell command, or do some other auxiliary function. _M_a_i_l provides these capabilities through _t_i_l_d_e _e_s_c_a_p_e_s, which consist of a tilde (~) at the beginning of a line, followed by a single charac- ter which indicates the function to be performed. For exam- ple, to print the text of the message so far, use: ~p which will print a line of dashes, the recipients of your message, and the text of the message so far. Since _M_a_i_l requires two consecutive RUBOUT's to abort a letter, you can use a single RUBOUT to abort the output of ~p or any other ~ escape without killing your letter. If you are dissatisfied with the message as it stands, you can invoke the text editor on it using the escape ~e which causes the message to be copied into a temporary file and an instance of the editor to be spawned. After modify- ing the message to your satisfaction, write it out and quit the editor. _M_a_i_l will respond by typing (continue) after which you may continue typing text which will be appended to your message, or type to end the message. A standard text editor is provided by _M_a_i_l. You can override this default by setting the valued option "EDI- TOR" to something else. For example, you might prefer: set EDITOR=/usr/ucb/ex Many systems offer a screen editor as an alternative to the standard text editor, such as the _v_i editor from UC Berkeley. To use the screen, or _v_i_s_u_a_l editor, on your current message, you can use the escape, ~v ~v works like ~e, except that the screen editor is invoked instead. A default screen editor is defined by _M_a_i_l. If it does not suit you, you can set the valued option "VISUAL" to the path name of a different editor. Mail Reference Manual 5/13/87 13 It is often useful to be able to include the contents of some file in your message; the escape ~r filename is provided for this purpose, and causes the named file to be appended to your current message. _M_a_i_l complains if the file doesn't exist or can't be read. If the read is suc- cessful, the number of lines and characters appended to your message is printed, after which you may continue appending text. The filename may contain shell metacharacters like * and ? which are expanded according to the conventions of your shell. As a special case of ~r, the escape ~d reads in the file "dead.letter" in your home directory. This is often useful since _M_a_i_l copies the text of your mes- sage there when you abort a message with RUBOUT. To save the current text of your message on a file you may use the ~w filename escape. _M_a_i_l will print out the number of lines and charac- ters written to the file, after which you may continue appending text to your message. Shell metacharacters may be used in the filename, as in ~r and are expanded with the conventions of your shell. If you are sending mail from within _M_a_i_l'_s command mode you can read a message sent to you into the message you are constructing with the escape: ~m 4 which will read message 4 into the current message, shifted right by one tab stop. You can name any non-deleted mes- sage, or list of messages. Messages can also be forwarded without shifting by a tab stop with ~f. This is the usual way to forward a message. If, in the process of composing a message, you decide to add additional people to the list of message recipients, you can do so with the escape ~t name1 name2 ... You may name as few or many additional recipients as you wish. Note that the users originally on the recipient list Mail Reference Manual 5/13/87 14 will still receive the message; you cannot remove someone from the recipient list with ~t. If you wish, you can associate a subject with your mes- sage by using the escape ~s Arbitrary string of text which replaces any previous subject with "Arbitrary string of text." The subject, if given, is sent near the top of the message prefixed with "Subject:" You can see what the mes- sage will look like by using ~p. For political reasons, one occasionally prefers to list certain people as recipients of carbon copies of a message rather than direct recipients. The escape ~c name1 name2 ... adds the named people to the "Cc:" list, similar to ~t. Again, you can execute ~p to see what the message will look like. The recipients of the message together constitute the "To:" field, the subject the "Subject:" field, and the car- bon copies the "Cc:" field. If you wish to edit these in ways impossible with the ~t, ~s, and ~c escapes, you can use the escape ~h which prints "To:" followed by the current list of reci- pients and leaves the cursor (or printhead) at the end of the line. If you type in ordinary characters, they are appended to the end of the current list of recipients. You can also use your erase character to erase back into the list of recipients, or your kill character to erase them altogether. Thus, for example, if your erase and kill char- acters are the standard # and @ symbols, ~h To: root kurt####bill would change the initial recipients "root kurt" to "root bill." When you type a newline, _M_a_i_l advances to the "Sub- ject:" field, where the same rules apply. Another newline brings you to the "Cc:" field, which may be edited in the same fashion. Another newline leaves you appending text to the end of your message. You can use ~p to print the current text of the header fields and the body of the mes- sage. 9 9 Mail Reference Manual 5/13/87 15 To effect a temporary escape to the shell, the escape ~!command is used, which executes _c_o_m_m_a_n_d and returns you to mailing mode without altering the text of your message. If you wish, instead, to filter the body of your message through a shell command, then you can use ~|command which pipes your message through the command and uses the output as the new text of your message. If the command pro- duces no output, _M_a_i_l assumes that something is amiss and retains the old version of your message. A frequently-used filter is the command _f_m_t, designed to format outgoing mail. To effect a temporary escape to _M_a_i_l command mode instead, you can use the ~:_M_a_i_l _c_o_m_m_a_n_d escape. This is especially useful for retyping the message you are replying to, using, for example: ~:t It is also useful for setting options and modifying aliases. If you wish (for some reason) to send a message that contains a line beginning with a tilde, you must double it. Thus, for example, ~~This line begins with a tilde. sends the line ~This line begins with a tilde. Finally, the escape ~? prints out a brief summary of the available tilde escapes. On some terminals (particularly ones with no lower case) tilde's are difficult to type. _M_a_i_l allows you to change the escape character with the "escape" option. For example, I set set escape=] 9 9 Mail Reference Manual 5/13/87 16 and use a right bracket instead of a tilde. If I ever need to send a line beginning with right bracket, I double it, just as for ~. Changing the escape character removes the special meaning of ~. _4._2. _N_e_t_w_o_r_k _a_c_c_e_s_s This section describes how to send mail to people on other machines. Recall that sending to a plain login name sends mail to that person on your machine. If your machine is directly (or sometimes, even, indirectly) connected to the Arpanet, you can send messages to people on the Arpanet using a name of the form name@host where _n_a_m_e is the login name of the person you're trying to reach and _h_o_s_t is the name of the machine where he logs in on the Arpanet. If your recipient logs in on a machine connected to yours by UUCP (the Bell Laboratories supplied network that communicates over telephone lines), sending mail to him is a bit more complicated. You must know the list of machines through which your message must travel to arrive at his site. So, if his machine is directly connected to yours, you can send mail to him using the syntax: host!name where, again, _h_o_s_t is the name of his machine and _n_a_m_e is his login name. If your message must go through an inter- mediate machine first, you must use the syntax: intermediate!host!name and so on. It is actually a feature of UUCP that the map of all the systems in the network is not known anywhere (except where people decide to write it down for convenience). Talk to your system administrator about the machines connected to your site. If you want to send a message to a recipient on the Berkeley network (Berknet), you use the syntax: host:name where _h_o_s_t is his machine name and _n_a_m_e is his login name. Unlike UUCP, you need not know the names of the intermediate machines. When you use the _r_e_p_l_y command to respond to a letter, there is a problem of figuring out the names of the users in Mail Reference Manual 5/13/87 17 the "To:" and "Cc:" lists _r_e_l_a_t_i_v_e _t_o _t_h_e _c_u_r_r_e_n_t _m_a_c_h_i_n_e. If the original letter was sent to you by someone on the local machine, then this problem does not exist, but if the message came from a remote machine, the problem must be dealt with. _M_a_i_l uses a heuristic to build the correct name for each user relative to the local machine. So, when you _r_e_p_l_y to remote mail, the names in the "To:" and "Cc:" lists may change somewhat. _4._3. _S_p_e_c_i_a_l _r_e_c_i_p_i_e_n_t_s As described previously, you can send mail to either user names or _a_l_i_a_s names. It is also possible to send mes- sages directly to files or to programs, using special con- ventions. If a recipient name has a `/' in it or begins with a `+', it is assumed to be the path name of a file into which to send the message. If the file already exists, the message is appended to the end of the file. If you want to name a file in your current directory (ie, one for which a `/' would not usually be needed) you can precede the name with `./' So, to send mail to the file "memo" in the current directory, you can give the command: % Mail ./memo If the name begins with a `+,' it is expanded into the full path name of the folder name in your folder directory. This ability to send mail to files can be used for a variety of purposes, such as maintaining a journal and keeping a record of mail sent to a certain group of users. The second exam- ple can be done automatically by including the full pathname of the record file in the _a_l_i_a_s command for the group. Using our previous _a_l_i_a_s example, you might give the com- mand: alias project sam sally steve susan /usr/project/mail_record Then, all mail sent to "project" would be saved on the file "/usr/project/mail_record" as well as being sent to the members of the project. This file can be examined using _M_a_i_l -_f. It is sometimes useful to send mail directly to a pro- gram, for example one might write a project billboard pro- gram and want to access it using _M_a_i_l. To send messages to the billboard program, one can send mail to the special name `|billboard' for example. _M_a_i_l treats recipient names that begin with a `|' as a program to send the mail to. An _a_l_i_a_s can be set up to reference a `|' prefaced name if desired. _C_a_v_e_a_t_s: the shell treats `|' specially, so it must be quoted on the command line. Also, the `| program' must be presented as a single argument to mail. The safest course is to surround the entire name with double quotes. This Mail Reference Manual 5/13/87 18 also applies to usage in the _a_l_i_a_s command. For example, if we wanted to alias `rmsgs' to `rmsgs -s' we would need to say: alias rmsgs "| rmsgs -s" 9 9 Mail Reference Manual 5/13/87 19 _5. _A_d_d_i_t_i_o_n_a_l _f_e_a_t_u_r_e_s This section describes some additional commands of use for reading your mail, setting options, and handling lists of messages. _5._1. _M_e_s_s_a_g_e _l_i_s_t_s Several _M_a_i_l commands accept a list of messages as an argument. Along with _t_y_p_e and _d_e_l_e_t_e, described in section 2, there is the _f_r_o_m command, which prints the message headers associated with the message list passed to it. The _f_r_o_m command is particularly useful in conjunction with some of the message list features described below. A _m_e_s_s_a_g_e _l_i_s_t consists of a list of message numbers, ranges, and names, separated by spaces or tabs. Message numbers may be either decimal numbers, which directly specify messages, or one of the special characters "|^" "." or "$" to specify the first relevant, current, or last relevant message, respectively. _R_e_l_e_v_a_n_t here means, for most commands "not deleted" and "deleted" for the _u_n_d_e_l_e_t_e command. A range of messages consists of two message numbers (of the form described in the previous paragraph) separated by a dash. Thus, to print the first four messages, use type 1-4 and to print all the messages from the current message to the last message, use type .-$ A _n_a_m_e is a user name. The user names given in the message list are collected together and each message selected by other means is checked to make sure it was sent by one of the named users. If the message consists entirely of user names, then every message sent by one those users that is _r_e_l_e_v_a_n_t (in the sense described earlier) is selected. Thus, to print every message sent to you by "root," do type root As a shorthand notation, you can specify simply "*" to get every _r_e_l_e_v_a_n_t (same sense) message. Thus, type * 9 9 Mail Reference Manual 5/13/87 20 prints all undeleted messages, delete * deletes all undeleted messages, and undelete * undeletes all deleted messages. You can search for the presence of a word in subject lines with /. For example, to print the headers of all mes- sages that contain the word "PASCAL," do: from /pascal Note that subject searching ignores upper/lower case differ- ences. _5._2. _L_i_s_t _o_f _c_o_m_m_a_n_d_s This section describes all the _M_a_i_l commands available when receiving mail. ! Used to preface a command to be executed by the shell. - The - command goes to the previous message and prints it. The - command may be given a decimal number _n as an argument, in which case the _nth previous message is gone to and printed. Print Like _p_r_i_n_t, but also print out ignored header fields. See also _p_r_i_n_t and _i_g_n_o_r_e. Reply Note the capital R in the name. Frame a reply to a one or more messages. The reply (or replies if you are using this on multiple messages) will be sent ONLY to the person who sent you the message (respectively, the set of people who sent the messages you are replying to). You can add people using the ~_t and ~_c tilde escapes. The subject in your reply is formed by pre- facing the subject in the original message with "Re:" unless it already began thus. If the original message included a "reply-to" header field, the reply will go _o_n_l_y to the recipient named by "reply-to." You type in your message using the same conventions available to you through the _m_a_i_l command. The _R_e_p_l_y command is especially useful for replying to messages that were sent to enormous distribution groups when you really just want to send a message to the originator. Use it often. Mail Reference Manual 5/13/87 21 Type Identical to the _P_r_i_n_t command. alias Define a name to stand for a set of other names. This is used when you want to send messages to a certain group of people and want to avoid retyping their names. For example alias project john sue willie kathryn creates an alias _p_r_o_j_e_c_t which expands to the four peo- ple John, Sue, Willie, and Kathryn. alternates If you have accounts on several machines, you may find it convenient to use the /usr/lib/aliases on all the machines except one to direct your mail to a single account. The _a_l_t_e_r_n_a_t_e_s command is used to inform _M_a_i_l that each of these other addresses is really _y_o_u. _A_l_t_e_r_n_a_t_e_s takes a list of user names and remembers that they are all actually you. When you _r_e_p_l_y to mes- sages that were sent to one of these alternate names, _M_a_i_l will not bother to send a copy of the message to this other address (which would simply be directed back to you by the alias mechanism). If _a_l_t_e_r_n_a_t_e_s is given no argument, it lists the current set of alternate names. _A_l_t_e_r_n_a_t_e_s is usually used in the .mailrc file. chdir The _c_h_d_i_r command allows you to change your current directory. _C_h_d_i_r takes a single argument, which is taken to be the pathname of the directory to change to. If no argument is given, _c_h_d_i_r changes to your home directory. copy The _c_o_p_y command does the same thing that _s_a_v_e does, except that it does not mark the messages it is used on for deletion when you quit. delete Deletes a list of messages. Deleted messages can be reclaimed with the _u_n_d_e_l_e_t_e command. dt The _d_t command deletes the current message and prints the next message. It is useful for quickly reading and disposing of mail. edit To edit individual messages using the text editor, the _e_d_i_t command is provided. The _e_d_i_t command takes a list of messages as described under the _t_y_p_e command and processes each by writing it into the file Message_x where _x is the message number being edited and execut- ing the text editor on it. When you have edited the Mail Reference Manual 5/13/87 22 message to your satisfaction, write the message out and quit, upon which _M_a_i_l will read the message back and remove the file. _E_d_i_t may be abbreviated to _e. else Marks the end of the then-part of an _i_f statement and the beginning of the part to take effect if the condi- tion of the _i_f statement is false. endif Marks the end of an _i_f statement. exit Leave _M_a_i_l without updating the system mailbox or the file your were reading. Thus, if you accidentally delete several messages, you can use _e_x_i_t to avoid scrambling your mailbox. file The same as _f_o_l_d_e_r. folders List the names of the folders in your folder directory. folder The _f_o_l_d_e_r command switches to a new mail file or folder. With no arguments, it tells you which file you are currently reading. If you give it an argument, it will write out changes (such as deletions) you have made in the current file and read the new file. Some special conventions are recognized for the name: Name Meaning 8 ___________________________________________ # Previous file read % Your system mailbox %name _N_a_m_e's system mailbox & Your ~/mbox file +folder A file in your folder directory from The _f_r_o_m command takes a list of messages and prints out the header lines for each one; hence from joe is the easy way to display all the message headers from "joe." headers When you start up _M_a_i_l to read your mail, it lists the message headers that you have. These headers tell you who each message is from, when they were sent, how many 9 Mail Reference Manual 5/13/87 23 lines and characters each message is, and the "Sub- ject:" header field of each message, if present. In addition, _M_a_i_l tags the message header of each message that has been the object of the _p_r_e_s_e_r_v_e command with a "P." Messages that have been _s_a_v_e_d or _w_r_i_t_t_e_n are flagged with a "*." Finally, _d_e_l_e_t_e_d messages are not printed at all. If you wish to reprint the current list of message headers, you can do so with the _h_e_a_d_e_r_s command. The _h_e_a_d_e_r_s command (and thus the initial header listing) only lists the first so many message headers. The number of headers listed depends on the speed of your terminal. This can be overridden by specifying the number of headers you want with the _w_i_n_- _d_o_w option. _M_a_i_l maintains a notion of the current "window" into your messages for the purposes of print- ing headers. Use the _z command to move forward and back a window. You can move _M_a_i_l'_s notion of the current window directly to a particular message by using, for example, headers 40 to move _M_a_i_l'_s attention to the messages around message 40. The _h_e_a_d_e_r_s command can be abbreviated to _h. help Print a brief and usually out of date help message about the commands in _M_a_i_l. Refer to this manual instead. hold Arrange to hold a list of messages in the system mail- box, instead of moving them to the file _m_b_o_x in your home directory. If you set the binary option _h_o_l_d, this will happen by default. if Commands in your ".mailrc" file can be executed condi- tionally depending on whether you are sending or receiving mail with the _i_f command. For example, you can do: if receive _c_o_m_m_a_n_d_s... endif An _e_l_s_e form is also available: if send _c_o_m_m_a_n_d_s... else _c_o_m_m_a_n_d_s... endif Note that the only allowed conditions are _r_e_c_e_i_v_e and _s_e_n_d. Mail Reference Manual 5/13/87 24 ignore Add the list of header fields named to the _i_g_n_o_r_e _l_i_s_t. Header fields in the ignore list are not printed on your terminal when you print a message. This allows you to suppress printing of certain machine-generated header fields, such as _V_i_a which are not usually of interest. The _T_y_p_e and _P_r_i_n_t commands can be used to print a message in its entirety, including ignored fields. If _i_g_n_o_r_e is executed with no arguments, it lists the current set of ignored fields. list List the vaild _M_a_i_l commands. mail Send mail to one or more people. If you have the _a_s_k option set, _M_a_i_l will prompt you for a subject to your message. Then you can type in your message, using tilde escapes as described in section 4 to edit, print, or modify your message. To signal your satisfaction with the message and send it, type control-d at the beginning of a line, or a . alone on a line if you set the option _d_o_t. To abort the message, type two inter- rupt characters (RUBOUT by default) in a row or use the ~_q escape. mbox Indicate that a list of messages be sent to _m_b_o_x in your home directory when you quit. This is the default action for messages if you do _n_o_t have the _h_o_l_d option set. next The _n_e_x_t command goes to the next message and types it. If given a message list, _n_e_x_t goes to the first such message and types it. Thus, next root goes to the next message sent by "root" and types it. The _n_e_x_t command can be abbreviated to simply a new- line, which means that one can go to and type a message by simply giving its message number or one of the magic characters "|^" "." or "$". Thus, . prints the current message and 4 prints message 4, as described previously. preserve Same as _h_o_l_d. Cause a list of messages to be held in your system mailbox when you quit. 9 9 Mail Reference Manual 5/13/87 25 quit Leave _M_a_i_l and update the file, folder, or system mail- box your were reading. Messages that you have examined are marked as "read" and messages that existed when you started are marked as "old." If you were editing your system mailbox and if you have set the binary option _h_o_l_d, all messages which have not been deleted, saved, or mboxed will be retained in your system mailbox. If you were editing your system mailbox and you did _n_o_t have _h_o_l_d set, all messages which have not been deleted, saved, or preserved will be moved to the file _m_b_o_x in your home directory. reply Frame a reply to a single message. The reply will be sent to the person who sent you the message to which you are replying, plus all the people who received the original message, except you. You can add people using the ~_t and ~_c tilde escapes. The subject in your reply is formed by prefacing the subject in the original mes- sage with "Re:" unless it already began thus. If the original message included a "reply-to" header field, the reply will go _o_n_l_y to the recipient named by "reply-to." You type in your message using the same conventions available to you through the _m_a_i_l command. save It is often useful to be able to save messages on related topics in a file. The _s_a_v_e command gives you ability to do this. The _s_a_v_e command takes as argument a lit of message numbers, followed by the name of the file on which to save the messages. The messages are appended to the named file, thus allowing one to keep several messages in the file, stored in the order they