Developer's Daily | Unix by Example |
main | java | perl | unix | dev directory | web log |
MAIL(1) BSD General Commands Manual MAIL(1)
NAME
mail ? send and receive mail |
SYNOPSIS
mail [?iInv] [?s subject] [?c cc-addr] [?b bcc-addr] to-addr... |
mail [?iInNv] ?f [name] |
mail [?iInNv] [?u user] |
INTRODUCTION |
Mail is an intelligent mail processing system, which has a command syntax reminiscent of ed(1) with lines replaced by messages. |
?v’ Verbose mode. The details of delivery are displayed on theuser’s terminal.
?i’ Ignore tty interrupt signals. This is particularly useful when using mail on noisy phone lines. ?I’ Forces mail to run in interactive mode even when input isn’t a terminal. In particular, the ’~’ special character when sending mail is only active in interactive mode. ?n’ Inhibits reading /etc/mail.rc upon startup. ?N’ Inhibits the initial display of message headers when reading mail or editing a mail folder. ?s’ Specify subject on command line (only the first argument after the ?s flag is used as a subject; be careful to quote subjects containing spaces.) ?c’ Send carbon copies to list of users. ?b’ Send blind carbon copies to list. List should be a comma-separated list of names. ?f’ Read in the contents of your mbox (or the specified file) for processing; when you quit, mail writes undeleted messages back to this file. ?u’ Is equivalent to: mail -f /var/spool/mail/user Sending mail Reading mail Disposing of mail. Specifying messages Replying to or originating mail. Ending a mail processing session. Personal and systemwide distribution lists. 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 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 reply to the recipients. System wide aliases 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. Network mail (ARPA, UUCP, Berknet) 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 |
(Adapted from the ‘Mail Reference Manual’) 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 ‘‘applicable messages’’ and aborts the command. |
?’ Print out the preceding message. If given a numeric argumentn, goes to the n’th previous message and prints it.
?’ Prints a brief summary of commands. !’ Executes the shell (see sh(1) and csh(1)) command which follows. Print Reply Type’ (T) Identical to the Print command. alias alternates chdir copy’ (co) 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 dp’ (also dt) Deletes the current message and prints the next message. If there is no next message, mail says ‘‘at EOF’’. 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. folders folder from’ (f) Takes a list of messages and prints their message headers. headers help’ A synonym for ? 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 mail’ (m) Takes as argument login names and distribution group names and sends mail to those people. mbox’ 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. next’ (n) like + or CR) Goes to the next message in sequence and types it. With an argument list, types the next matching message. preserve print 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 respond retain 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. set’ (se) 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. ‘‘set indentprefix="->"’’ saveignore saveretain shell size’ Takes a message list and prints out the size in characters of each message. source top’ 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. type’ (t) A synonym for print. unalias undelete unread unset visual write xit’ (x) A synonym for exit. z’ Mail presents message headers 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?. Tilde/Escapes 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 by the option escape. ~!command ~bname ... ~cname ... ~d’ Read the file ‘‘dead.letter’’ from your home directory into the message. ~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. ~fmessages ~Fmessages ~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. ~mmessages ~Mmessages ~p’ Print out the message collected so far, prefaced by the message header fields. ~q’ Abort the message being sent, copying the message to ‘‘dead.letter’’ in your home directory if save is set. ~rfilename ~sstring ~tname ... ~v’ Invoke an alternate editor (defined by the VISUAL 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. ~wfilename ~|command ~:mail-command ~~string Mail Options append ask, asksub askcc askbcc autoprint debug 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 by default. ignore ignoreeof metoo noheader nosave Replyall quiet searchheaders verbose Option String Values EDITOR’ Pathname of the text editor to use in the edit command and ~e escape. If not defined, then a default editor is used. LISTER’ Pathname of the directory lister to use in the folders command. Default is /bin/ls. PAGER’ Pathname of the program to use in the more command or when crt variable is set. The default paginator more(1) is used if this option is not defined. SHELL’ Pathname of the shell to use in the ! command and the ~! escape. A default shell is used if this option is not defined. VISUAL’ Pathname of the text editor to use in the visual command and ~v escape. crt’ The valued option crt is used as a threshold to determine how long a message must be before PAGER is used to read it. If crt is set without a value, then the height of the terminal screen stored in the system is used to compute the threshold (see stty(1)). 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. MBOX’ The name of the mbox file. It can be the name of a folder. The default is ‘‘mbox’’ in the user’s home directory. 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. indentprefix 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. ENVIRONMENT |
Mail utilizes the HOME, USER, SHELL, DEAD, PAGER, LISTER, EDITOR, VISUAL and MBOX environment variables. |
FILES
/var/spool/mail/*’ Post office.
~/mbox’ User’s old mail. SEE ALSO |
fmt(1), newaliases(1), vacation(1), aliases(5), mailaddr(7), sendmail(8) and |
The Mail Reference Manual..
HISTORY
A mail command appeared in Version 6 AT&T UNIX. This man page is derived from The Mail Reference Manual originally written by Kurt Shoens. |
BUGS
There are some flags that are not documented here. Most are not useful to the general user. 4th Berkeley Distribution December 30, 1993 4th Berkeley Distribution |