mail_bsd(1)
Mail - send and receive mail
As shipped in IRIX 6.5.19. Unchanged since IRIX 6.5.
NAME Mail - send and receive mail SYNOPSIS Mail [ -v ] [ -i ] [ -n ] [ -s subject ] [ user... ] Mail [ -v ] [ -i ] [ -n ] -f [ name ] Mail [ -v ] [ -i ] [ -n ] -u user INTRODUCTION Mail is an interactive mail processing system, which has a command syntax reminiscent of ed with lines replaced by messages. The -v flag puts Mail into verbose mode; the details of delivery are displayed on the users terminal. The -i flag causes tty interrupt signals to be ignored. This is particularly useful when using Mail on noisy phone lines. The -n flag inhibits the reading of /usr/lib/Mail.rc. Sending mail. To send a message to one or more other people, Mail can be invoked with arguments which are the names of people to send to. You are then expected to type in your message, followed by an EOT (control-D) at the beginning of a line. A subject may be specified on the command line by using the -s flag. (Only the first argument after the -s flag is used as a subject; be careful to quote subjects containing spaces.) The section below, labeled Replying to or originating mail, describes some features of Mail available to help you compose your letter. Reading mail. In normal usage Mail is given no arguments. It checks your mail out of your system mailbox, then prints out a one line summary of each message there. The current message is initially the first message (numbered 1) and can be printed using the print command (which can be abbreviated p). You can move among the messages much as you move between lines in ed, with the commands `+' and `-' moving backwards and forwards, and simple numbers. Disposing of mail. After examining a message you can delete (d) the message or reply (r) to it. Deletion causes the Mail program to forget about the message. This is not irreversible; the message can be undeleted (u) by giving its number, or the Mail session can be aborted by giving the exit (x) command. Deleted messages will, however, usually disappear never to be seen again. Specifying messages. Commands such as print delete and from can be given a list of messages as an argument in order to apply to a number of messages at once. This list of messages can be specified in one of three mutually exclusive ways: First, messages may be specified by message number. Thus ``delete 1 2'' deletes messages 1 and 2, while ``delete 1-5'' deletes messages 1 through 5. In conjunction with message numbers, the following special names may also be used: The special name `^' addresses the first message, and `$' addresses the last message. Second, messages may be specified by sender's name, sender's name substring or subject substring. You may supply a list of whitespace separated message senders' names and/or message senders' names substrings and/or message subject substrings to commands accepting message lists. A message sender's name is a string of characters which must begin with an alphabetic character, and must match exactly the sender's name in the target message. A message sender's name substring is a `?' character immediately followed (no whitespace) by a string of characters and specifies all messages with a sender's name containing the character string as a substring. A message subject is a `/' character immediately followed (no whitespace) by a string of characters and specifies all messages with a subject line containing the character string as a substring. Examples: ``from foo'' lists all messages from ``foo'' exactly, while ``from /foo'' lists all messages with substring ``foo'' in their subject lines and ``from ?foo'' lists all messages with substring foo in their senders' names. Third, the special name `*' can be used to address all messages. Thus the command top which prints the first few lines of a message could be used as ``top *'' to print the first few lines of all messages. Replying to or originating mail. You can use the reply command to set up a response to a message, sending it back to the person who it was from. Text you then type in, up to an end-of-file, defines the contents of the message. While you are composing a message, Mail treats lines beginning with the character `~' specially. For instance, typing ``~m'' (alone on a line) will place a copy of the current message into the response right shifting it by a tabstop. Other escapes will set up subject fields, add and delete recipients to the message and allow you to escape to an editor to revise the message or to a shell to run some commands. (These options are given in the summary below.) Incorporating new mail. You can read new mail which has arrived during the session by using the folder command to reread your system mailbox. A convenient way to do this is to type the command ``folder %'' or ``fo %''. This will have the same effect as typing the quit command to end the session (see below) and then re-invoking Mail with no arguments. Ending a mail processing session. You can end a Mail session with the quit (q) or exit (x) commands. If you use the quit command, messages which have been examined will be moved to your mbox file, messages which have been deleted are discarded, and unexamined messages are copied back to your system mailbox. If you have used the -f option to read in the contents of your mbox (or other file) for processing; when you quit, Mail writes undeleted messages back to this file. In the event that Mail cannot rewrite mbox (or other file) to write back messages, Mail will print a message indicating the trouble and will not exit. This gives you the option of trying to set things right. If things cannot be set right, you can escape Mail by using the exit command described below. If you use the exit command, Mail exits without making any modifications to the mail file. Deleted messages will not be discarded. Personal and systemwide distribution lists. It is also possible to create a personal distribution lists so that, for instance, you can send mail to ``cohorts'' and have it go to a group of people. Such lists can be defined by placing a line like alias cohorts bill ozalp jkf mark kridle@ucbcory in the file .mailrc in your home directory. The current list of such aliases can be displayed with the alias (a) command in Mail. System wide distribution lists can be created by editing /usr/lib/Mail.rc (which may contain other Mail commands such as set). An alias of the form alias bob sauron!bob will be ignored on the sauron system so that the same /usr/lib/Mail.rc or ~/.mailrc file may be used on several machines with correct behavior. You may include a pathname in the distribution list, and Mail will record outgoing messages in that file. It is preferable to place pathnames and folders in the ``Bcc:'' list, to prevent recipients from replying to a nonexistent filename. Forwarding mail. Forwarding of mail is done via the .forward file mechanism of the sendmail(1M) program. Please see the sendmail(1M) manual page for details. Signatures. A signature line (or lines) may be automatically appended to the end of all outgoing letters by placing the text in the file .lsignature, .rsignature, or .signature in your home directory. The file .lsignature is used for local mail, that is the recipients specified do not have `!' or `@' in their names (prior to aliasing) and the file .rsignature is used for remote mail. If the appropriate one of these does not exist, .signature is used for compatibility with previous versions of Mail. Mail has a number of options which can be set in the .mailrc file to alter its behavior; thus ``set askcc'' enables the ``askcc'' feature. (These options are summarized below.) SUMMARY Each command is typed on a line by itself, and may take arguments following the command word. The command need not be typed in its entirety - the first command which matches the typed prefix is used. For commands which take message lists as arguments, if no message list is given, then the next message forward which satisfies the command's requirements is used. If there are no messages forward of the current message, the search proceeds backwards, and if there are no good messages at all, Mail types ``No applicable messages'' and aborts the command. ! Executes the UNIX shell command which follows. - Goes to the previous message and prints it out. = Prints the current message number. ? If the qmarkishelp option is set (see below), this is a synonym for the help command. Otherwise, ? indicates the start of a sender's name substring message list (see ``Specifying messages'' above). More (M) Like Print but invokes your pager. New (N) Identical to the unread command. Page (Pa) A synonym for More. Print (P) Like print but also prints out ignored header fields. See also print and ignore. Reply (R) Reply to originator. Does not reply to other recipients of the original message. Respond (Res) A synonym for Reply Type (T) Identical to the Print command. Unread (U) Identical to the unread command. alias (a) With no arguments, prints out all currently-defined aliases. With one argument, prints out that alias. With more than one argument, creates an new or changes an on old alias. alternates (alt) The alternates command is useful if you have accounts on several machines. It can be used to inform Mail that the listed addresses are really you. When you reply to messages, Mail will not send a copy of the message to any of the addresses listed on the alternates list. If the alternates command is given with no argument, the current set of alternate names is displayed. chdir (cd) Changes the user's working directory to that specified, if given. If no directory is given, then changes to the user's login directory. copy (c) The copy command does the same thing that save does, except that it does not mark the messages it is used on for deletion when you quit. delete (d) Takes a list of messages as argument and marks them all as deleted. Deleted messages will not be saved in mbox, nor will they be available for most other commands. discard (di) A synonym for ignore. dp (also dt) Deletes the current message and prints the next message. If there is no next message, Mail says ``at EOF.'' echo (ec) Takes a string and echos it to standard output. edit (e) Takes a list of messages and points the text editor at each one in turn. On return from the editor, the message is read back in. exit (ex or x) Effects an immediate return to the Shell without modifying the user's system mailbox, his mbox file, or his edit file in -f. file (fi) The same as folder. folder (fo) The folder 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 in the new file. Some special conventions are recognized for the name. @ means the current file in read- only mode, $ means the current file, in read/write mode if possible, # means the previous file, % means your system mailbox, %user means user's system mailbox, & means your ~/mbox file, and +folder means a file in your folder directory. Issuing the command ``folder %'' while you are reading your system mailbox is a convenient way to incorporate new mail which has arrived during the session. folders List the names of the folders in your folder directory. from (f) Takes a list of messages and prints their summary lines. See the Specifying messages section above for examples of how to use this command to list only the messages from a particular person, or about a particular subject. group (g) A synonym for alias. hd Lists the message summary lines of all deleted messages. These are the messages that have been deleted by the delete command, but that have not yet been removed from the mailbox. These messages may be undeleted by use of the undelete command. headers (h) Lists the current group of message summary lines (historically called "headers"). Summary lines are grouped and displayed by windowfuls (as many lines as will fit in the window). If there are more summary lines than will fit in the current window, the z command can be used to scroll through multiple summary line groups. help Prints a brief summary of commands. hold (ho, also preserve) Takes a message list and marks each message therein to be saved in the user's system mailbox instead of in mbox. Does not override the delete command. ignore (ig) Add the list of header fields named to the ignored list. Header fields in the ignore list are not printed on your terminal when you print a message. This command is very handy for suppression of certain machine-generated header fields. The Type and Print commands can be used to print a message in its entirety, including ignored fields. If ignore is executed with no arguments, it lists the current set of ignored fields. list (li) Prints the list of all Mail commands. mail (m) Takes as argument login names and distribution group names and sends mail to those people. mbox (mb) Indicate that a list of messages be sent to mbox in your home directory when you quit. This is the default action for messages if you do not have the hold option set. more (mo) Like print but invokes your pager. new Identical to the unread command next (n like + or CR) Goes to the next message in sequence and types it. With an argument list, types the next matching message. page (pa) A synonym for more. preserve (pre) A synonym for hold. print (p) Takes a message list and types out each message on the user's terminal. quit (q) Terminates the session, saving all undeleted, unsaved messages in the user's mbox file in his login directory, preserving all messages marked with hold or preserve or never referenced in his system mailbox, and removing all other messages from his system mailbox. If new mail has arrived during the session, the message ``You have new mail'' is given. If given while editing a mailbox file with the -f flag, then the edit file is rewritten. A return to the Shell is effected, unless the rewrite of edit file fails, in which case the user can escape with the exit command. reply (r) A synonym for Reply. replyall (ra or RA) Takes a message list and sends mail to the sender and all recipients of the specified message. The default message must not be deleted. respond (res) A synonym for Reply. save (s) Takes a message list and a filename and appends each message in turn to the end of the file. The filename in quotes, followed by the line count and character count is echoed on the user's terminal. If filename does not already exist it will be created. If filename begins with a ``|'' or ``!'' then it will be interpreted as a shell command and the contents of the messages passed to it on standard input. set (se) With no arguments, prints all variable values. Otherwise, sets option. Arguments are of the form ``option=value'' or ``option.'' shell (sh) Invokes an interactive version of the shell. size (si) Takes a message list and prints out the size in characters of each message. source (so) The source command reads Mail commands from a file. top (to) Takes a message list and prints the top few lines of each. The number of lines printed is controlled by the variable toplines and defaults to five. touch (tou) Takes a message list and causes each message therein to be saved in either the user's system mailbox or in mbox according to the state of the hold option. type (t) A synonym for print. undelete (u) Takes a message list and marks each one as not being deleted. unread (unr or U) Takes a message list and marks each message as not having been read. Also see the Unread command. unset Takes a list of option names and discards their remembered values; the inverse of set. version (ve) Prints the version number of Mail that you are using. visual (v) Takes a message list and invokes the display editor on each message. write (w) Like save except that the message header and the blank line after the message body are not appended to the file. Only the message body of each message is appended to the file. xit (x) A synonym for exit. z Mail presents message summary lines in windowfuls as described under the headers command. You can move Mail's attention forward to the next window with the z command. Also, you can move to the previous window by using z-. Here is a summary of the tilde escapes, which are used when composing messages to perform special functions. Tilde escapes are only recognized at the beginning of lines. The name ``tilde escape'' is somewhat of a misnomer since the actual escape character can be set via the escape option. ~! command Execute the indicated shell command, then return to the message. ~: command Execute the indicated Mail command, then return to the message. ~? Display the tilde escape help file. ~b name ... Add the given names to the list of blind carbon copy (``Bcc:'') recipients. ~c name ... Add the given names to the list of carbon copy (``Cc:'') recipients. ~cm string Cause the string to become the current ``Comments:'' field. ~d Read the file ``dead.letter'' from your home directory into the message. ~E Invoke the text editor on the entire message collected so far including the message header fields. The existing message header fields will be displayed above a dashed line and the existing message body will be displayed below the dashed line. You are free to edit the message headers and body at will, but you must be careful that the final format of the headers conforms to the RFC 822 standard. You must also take care that no blank lines appear within the header section of the message and that you do not remove the dashed line separating the message headers from the message body. After the editing session is finished, you may continue appending text to the message. ~e Invoke the text editor on the body of the message collected so far. After the editing session is finished, you may continue appending text to the message. ~eh Same as ~E above. ~en string Cause the string to become the current ``Encrypted:'' field. ~f messages Read the named messages into the message being sent. If no messages are specified, read in the current message. ~H Edit all standard message header fields by typing each one in turn and allowing the user to append text to the end or modify the field by using the current terminal erase and kill characters. ~h Edit the basic message header fields (To:, Subject:, Cc:, Bcc:) by typing each one in turn and allowing the user to append text to the end or modify the field by using the current terminal erase and kill characters. ~irt string Add the string to the ``In-Reply-To:'' list. ~k string Add the string to the ``Keywords:'' list. ~m messages Read the named messages into the message being sent shifted right one tab. Note that if the mprefix option is set (see below), the tab will be replaced with the specified string. If no messages are specified, read the current message. ~p Print out the message collected so far. First the message header fields are displayed followed by a dashed line separator, then the message body. ~q Abort the message being sent, copying the message to ``dead.letter'' in your home directory. ~r file Read the named file into the message. ~rf string Add the string to the ``References:'' list. ~rr [string] Cause a ``Return-Receipt-To:'' field to be added to the message. If the string is specified, it will be added to the list of recipients in the ``Return-Receipt-To:'' field. If the string is not specified and no ``Return- Receipt-To:'' field exists in the message, one will be created and your user name will be specified. If the string is not specified and a ``Return-Receipt-To:'' field already exists in the message, the entire field will be removed. If the ``Return-Receipt-To:'' header field is present when the message is sent, and if the intervening mail delivery system supports return receipts, a return receipt will be sent to your mailbox when the message is successfully delivered to each of the specified recipients. ~rt name ... Add the given names to the ``Reply-To:'' list. ~s string Cause the string to become the current ``Subject:'' field. ~t name ... Add the given names to the direct recipients (``To:'') list. ~V Invoke an alternate editor (defined by the VISUAL option) on the entire message collected so far including the message header fields. The existing message header fields will be displayed above a dashed line and the existing message body will be displayed below the dashed line. You are free to edit the message headers and body at will, but you must be careful that the final format of the headers conforms to the RFC 822 standard. You must also take care that no blank lines appear within the header section of the message and that you do not remove the dashed line separating the message headers from the message body. After the editing session is finished, you may continue appending text to the message. ~v Invoke an alternate editor (defined by the VISUAL option) on the body of the message collected so far. Usually, the alternate editor will be a screen editor. After you quit the editor, you may resume appending text to the end of your message. ~vh Same as ~V above. ~w file Write the message onto the named file. ~|command Pipe the message through the command as a filter. If the command gives no output or terminates abnormally, retain the original text of the message. The command fmt(1) is often used as command to rejustify the message. ~~string Insert the string into the message prefaced by a single ~. If you have changed the escape character, then you should double that character in order to send it. Options are controlled via the set and unset commands. Options may be either binary, in which case it is only significant to see whether they are set or not, or string, in which case the actual value is of interest. The binary options include the following: Replyall Swaps the behavior of the r/Reply/Respond and ra/Replyall commands resulting in a more BSD-like interface. append Causes messages saved in mbox to be appended to the end rather than prepended. (This is set in /usr/lib/Mail.rc on version 7 systems.) ask Causes Mail to prompt you for the subject of each message you send. If you respond with simply a newline, no subject field will be sent. askcc Causes you to be prompted for additional carbon copy recipients at the end of each message. Responding with a newline indicates your satisfaction with the current list. autoprint Causes the delete command to behave like dp - thus, after deleting a message, the next one will be typed automatically. crt Causes your pager to be invoked if a message to be printed is longer than the current window. This option can also be used as a valued option (see below). dot The binary option dot causes Mail to interpret a period alone on a line as the terminator of a message you are sending. hold This option is used to hold messages in the system mailbox (instead of mbox ) by default. ignore Causes interrupt signals from your terminal to be ignored and echoed as @'s. ignoreeof An option related to dot is ignoreeof which makes Mail refuse to accept a control-D as the end of a message. Ignoreeof also applies to Mail command mode. keep Prevents Mail from deleting empty mailboxes when you quit. keepsave If set, messages which are saved via the save command are not deleted from the current mailbox automatically. metoo Usually, when a group is expanded that contains the sender, the sender is removed from the expansion. Setting this option causes the sender to be included in the group. noaskrolock Normally, when Mail encounters a mailfile which is read- only locked, it interactively asks the user how he wants to proceed. This option causes Mail to bypass the interactive dialog and automatically open the mailfile in read-only mode. In order to select a different automatic behaviour, this option can be used as a valued option (see below). noheader Suppresses the printing of message summary lines when Mail is first invoked. nosave Normally, when you abort a message with two RUBOUT, Mail copies the partial letter to the file ``dead.letter'' in your home directory. Setting the binary option nosave prevents this. qmarkishelp If set, ? becomes a synonym for the help command. quiet Suppresses the printing of the version when Mail is first invoked. showlast If this option is set at the time when Mail is first invoked, and if no new or unread messages are present in the system mailbox, Mail will display the last windowful of summary lines first, and will set the current message to be the last message in the mailfile. This option only makes sense when used with the hold option described above. showmsize If this option is set, Mail will include the line count and character count on the summary line for each message. showto Causes Mail to display the recipient instead of sender when displaying the summary line of a message for which you were the sender (your user name appears in the From: header field). This is useful when using Mail to browse or edit a file of saved outgoing mail such as is created when the record option is defined (see below). verbose Setting the option verbose is the same as using the -v flag on the command line. When mail runs in verbose mode, the actual delivery of messages is displayed on the users terminal. The following options have string values: EDITOR Pathname of the text editor to use in the edit command and and ~eh escapes. This defaults to the value of the EDITOR environment variable. HOME The pathname of your home directory. This defaults to the value of the HOME environment variable. PAGER Pathname of your pager to use in the More or more commands, or if the crt option is selected. If not defined, this defaults to the value of the PAGER environment variable. If the PAGER environment variable is not defined either, then more(1) is the default. SHELL Pathname of the shell to use in the ! command and the ~! escape. This defaults to the value of the SHELL environment variable. TMPDIR The directory to use for temporary files. This defaults to the value of the TMPDIR environment variable. If the TMPDIR environment variable is not defined either, then /tmp is the default. VISUAL Pathname of the text editor to use in the visual command and ~v and ~vh escapes. command: Allows the user to ``alias'' commands. Syntax is: set command:x=y Where x is a new name for the command and y is the original command. For example: set command:ls=headers defines a new command ``ls'' which is equivalent to the existing ``headers'' command. crt If crt is used as a valued option (see above for a description of how crt is used as a binary option), it is used as a threshold to determine how long a message must be before the user's pager is used to read it. In effect, this allows the user to override the current window size which would be used in the case of the binary crt option. escape If defined, the first character of this option gives the character to use in the place of ~ to denote escapes. folder The name of the directory to use for storing folders of messages. If this name begins with a `/', Mail considers it to be an absolute pathname; otherwise, the folder directory is found relative to your home directory. mprefix If defined, gives the string which will be prepended to each inserted line when using the ~m command to insert text from a previous message into the current message being composed. If not defined a tab will be the default. noaskrolock Normally, when Mail encounters a mailfile which is read- only locked, it interactively asks the user how he wants to proceed. This option causes Mail to bypass the interactive dialog and automatically proceed as follows: If set to "R" or "r", Mail will open the mailfile read- only. If set to "W" or "w", Mail will forcibly acquire the lock and open the mailfile read-write. record If defined, gives the pathname of the file used to record all outgoing mail. If not defined, then outgoing mail is not so saved. replyto If defined, gives the address which should be entered into the Reply-To: header field for all outgoing mail. sendmail If defined, gives the full pathname of the mail transfer agent program to use to send mail. If not set, /usr/lib/sendmail will be used. It is usually unnecessary to set this option. toplines If defined, gives the number of lines of a message to be printed out with the top command; normally, the first five lines are printed. FILES $HOME/mbox Your saved mail (unless the hold option is set). $HOME/dead.letter File where the text of the last aborted message will be saved (unless the nosave option is set). Note that in the event of a delivery failure, sendmail may append the failed message to ``dead.letter.'' This may result in multiple messages being present in ``dead.letter.'' $HOME/.mailrc File giving initial mail commands. $HOME/.lsignature File to append to outgoing local mail. $HOME/.rsignature File to append to outgoing remote mail. $HOME/.signature File to append to outgoing mail if .lsignature and .rsignature do not exist. $TMPDIR/R* Misc. temporary files. $TMPDIR/Message* Temporary editor files. /usr/mail/* System mail directory. /usr/mail/user System mailbox for user. /usr/mail/user.lock Lock for user's mailbox. /usr/mail/user.rolock Read-only lock for user's mailbox. Used to prevent file contention between multiple Mail instances. /usr/lib/Mail.help* Help files. /usr/lib/Mail.rc System initialization file. /usr/sbin/Mail Mail program. SEE ALSO mail_att(1), sendmail(1M). Internet RFC 822 - Standard for the Format of Internet Text Messages. WARNINGS Mail recognizes and acts upon tilde escapes in the body of the message being collected on standard input regardless of whether or not standard input is connected to a tty. If you redirect Mail 's standard input to come from a file or pipe: Mail someuser < msgfile or cat msgfile | Mail someuser you must take care to insure that no line of msgfile inadvertently begins with a '~' character or Mail will produce unwanted results. Note that there is nothing wrong with imbedding tilde escapes in the body of such a msgfile provided you know what you are doing. Such imbedded tilde escapes are useful for setting the Cc: list, arranging return receipts, and performing other functions not available via command line options. BUGS There are many flags that are not documented here. Most are not useful to the general user.