in the file .mailrc in your home directory. The current list of such aliases can be displayed with the command in mail . System wide distribution lists can be created by editing /etc/aliases , see aliases ( 5) and sendmail ( 8 ;) these are kept in a different syntax. In mail you send, personal aliases will be expanded in mail sent to others so that they will be able to to the recipients. System wide are not expanded when the mail is sent, but any reply returned to the machine will have the system wide alias expanded as all mail goes through sendmail ( .)
Mail has a number of options which can be set in the .mailrc file to alter its behavior; thus enables the askcc feature. (These options are summarized below.)
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 and aborts the command.
Ic - Print out the preceding message. If given a numeric argument n , goes to the n Ns 'th previous message and prints it. Ic ? Prints a brief summary of commands. Ic ! Executes the shell (see sh (1) and csh (1)) command which follows. Ic Print Like but also prints out ignored header fields. See also and Ic Reply Reply to originator. Does not reply to other recipients of the original message. Ic Type Identical to the command. Ic alias With no arguments, prints out all currently-defined aliases. With one argument, prints out that alias. With more than one argument, creates a new alias or changes an old one. Ic alternates The 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 to messages, mail will not send a copy of the message to any of the addresses listed on the list. If the command is given with no argument, the current set of alternate names is displayed. Ic chdir Changes the user's working directory to that specified, if given. If no directory is given, then changes to the user's login directory. Ic copy The command does the same thing that does, except that it does not mark the messages it is used on for deletion when you quit. Ic delete 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. Ic dp (also Deletes the current message and prints the next message. If there is no next message, mail says Ic edit 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. Ic exit or Effects an immediate return to the Shell without modifying the user's system mailbox, his mbox file, or his edit file in Ic file The same as Ic folders List the names of the folders in your folder directory. Ic folder The 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 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. Ic from Takes a list of messages and prints their message headers. Ic headers Lists the current range of headers, which is an 18-message group. If a argument is given, then the next 18-message group is printed, and if a argument is given, the previous 18-message group is printed. Ic help A synonym for Ic hold also 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 command. Ic ignore 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 and commands can be used to print a message in its entirety, including ignored fields. If is executed with no arguments, it lists the current set of ignored fields. Ic mail Takes as argument login names and distribution group names and sends mail to those people. Ic mbox Indicate that a list of messages be sent to in your home directory when you quit. This is the default action for messages if you do not have the option set. Ic next like or CR ) Goes to the next message in sequence and types it. With an argument list, types the next matching message. Ic preserve A synonym for Ic print Takes a message list and types out each message on the user's terminal. Ic quit Terminates the session, saving all undeleted, unsaved messages in the user's mbox file in his login directory, preserving all messages marked with or 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 is given. If given while editing a mailbox file with the 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 command. Ic reply Takes a message list and sends mail to the sender and all recipients of the specified message. The default message must not be deleted. Ic respond A synonym for Ic retain Add the list of header fields named to the retained list Only the header fields in the retain list are shown on your terminal when you print a message. All other header fields are suppressed. The and commands can be used to print a message in its entirety. If is executed with no arguments, it lists the current set of retained fields. Ic save 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. Ic set With no arguments, prints all variable values. Otherwise, sets option. Arguments are of the form option=value (no space before or after =) or option . Quotation marks may be placed around any part of the assignment statement to quote blanks or tabs, i.e. Ic saveignore is to what is to and Header fields thus marked are filtered out when saving a message by or when automatically saving to mbox . Ic saveretain is to what is to and Header fields thus marked are the only ones saved with a message when saving by or when automatically saving to mbox . overrides Ic shell Invokes an interactive version of the shell. Ic size Takes a message list and prints out the size in characters of each message. Ic source The command reads commands from a file. Ic top Takes a message list and prints the top few lines of each. The number of lines printed is controlled by the variable and defaults to five. Ic type A synonym for Ic unalias Takes a list of names defined by commands and discards the remembered groups of users. The group names no longer have any significance. Ic undelete Takes a message list and marks each message as being deleted. Ic unread Takes a message list and marks each message as having been read. Ic unset Takes a list of option names and discards their remembered values; the inverse of Ic visual Takes a message list and invokes the display editor on each message. Ic write Similar to except that the message body the header) is saved. Extremely useful for such tasks as sending and receiving source program text over the message system. Ic xit A synonym for Ic z Mail presents message headers in windowfuls as described under the command. You can move mail Ns 's attention forward to the next window with the command. Also, you can move to the previous window by using
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 is somewhat of a misnomer since the actual escape character can be set by the option
Ic ~! Ns Ar command Execute the indicated shell command, then return to the message. Ic ~b Ns Ar name ... Add the given names to the list of carbon copy recipients but do not make the names visible in the Cc: line ("blind" carbon copy). Ic ~c Ns Ar name ... Add the given names to the list of carbon copy recipients. Ic ~d Read the file from your home directory into the message. Ic ~e Invoke the text editor on the message collected so far. After the editing session is finished, you may continue appending text to the message. Ic ~f Ns Ar messages Read the named messages into the message being sent. If no messages are specified, read in the current message. Message headers currently being ignored (by the or command) are not included. Ic ~F Ns Ar messages Identical to except all message headers are included. Ic ~h Edit the 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. Ic ~m Ns Ar messages Read the named messages into the message being sent, indented by a tab or by the value of indentprefix . If no messages are specified, read the current message. Message headers currently being ignored (by the or command) are not included. Ic ~M Ns Ar messages Identical to except all message headers are included. Ic ~p Print out the message collected so far, prefaced by the message header fields. Ic ~q Abort the message being sent, copying the message to in your home directory if is set. Ic ~r Ns Ar filename Read the named file into the message. Ic ~s Ns Ar string Cause the named string to become the current subject field. Ic ~t Ns Ar name ... Add the given names to the direct recipient list. Ic ~v Invoke an alternate editor (defined by the option) on 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. Ic ~w Ns Ar filename Write the message onto the named file. Ic ~| Ns Ar 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 to rejustify the message. Ic ~: Ns Ar mail-command Execute the given mail command. Not all commands, however, are allowed. Ic ~~ Ns Ar string Insert the string of text in the message prefaced by a single ~. If you have changed the escape character, then you should double that character in order to send it.
Usually, mail is just a link to Mail , which can be confusing.