1 .\" Copyright (c) 1980, 1990, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 4. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" @(#)mail.1 8.8 (Berkeley) 4/28/95
38 .Nd send and receive mail
47 .Op Fl Ar sendmail-option ...
64 utility is an intelligent mail processing system, which has
65 a command syntax reminiscent of
67 with lines replaced by messages.
69 The following options are available:
70 .Bl -tag -width indent
74 delivery are displayed on the user's terminal.
79 mail option for details.
81 Test for the presence of mail in the (by default, system)
83 An exit status of 0 is returned if
84 it has mail; otherwise, an exit status
87 Write a header summary only, then exit.
89 Do not send messages with an empty body.
90 This is useful for piping errors from
94 Ignore tty interrupt signals.
96 particularly useful when using
102 to run in interactive mode even when
103 input is not a terminal.
107 character when sending mail is only active in interactive mode.
109 Inhibit reading the system-wide
113 Inhibit the initial display of message headers
114 when reading mail or editing a mail folder.
119 (Only the first argument after the
121 flag is used as a subject; be careful to quote subjects
124 Send carbon copies to
129 argument should be a comma-separated list of names.
131 Send blind carbon copies to
136 argument should be a comma-separated list of names.
138 Read in the contents of your
140 (or the specified file)
141 for processing; when you
144 writes undeleted messages back to this file.
146 Record the message in a file named after the first
148 The name is the login-name portion of the
149 address found first on the
151 line in the mail header.
158 .Dl "mail -f /var/mail/user"
160 .Ss "Startup Actions"
163 will execute commands in the system command files
164 .Pa /usr/share/misc/mail.rc ,
165 .Pa /usr/local/etc/mail.rc
168 in order, unless explicitly told not to by the use of the
171 Next, the commands in the user's personal command file
176 utility then examines its command line options to determine whether a
177 new message is to be sent, or whether an existing mailbox is to
180 To send a message to one or more people,
182 can be invoked with arguments which are the names of people to
183 whom the mail will be sent.
184 You are then expected to type in
185 your message, followed
188 at the beginning of a line.
190 .Sx "Replying To or Originating Mail" ,
191 describes some features of
193 available to help you compose your letter.
197 is given no arguments and checks your mail out of the
199 prints out a one line header of each message found.
200 The current message is initially the first message (numbered 1)
201 and can be printed using the
203 command (which can be abbreviated
205 You can move among the messages much as you move between lines in
211 moving backwards and forwards, and
213 .Ss "Disposing of Mail"
214 After examining a message you can
223 program to forget about the message.
224 This is not irreversible; the message can be
227 by giving its number, or the
229 session can be aborted by giving the
233 Deleted messages will, however, usually disappear never to be seen again.
234 .Ss "Specifying Messages"
239 can be given a list of message numbers as arguments to apply
240 to a number of messages at once.
243 deletes messages 1 and 2, while
245 deletes messages 1 through 5.
248 addresses all messages, and
251 the last message; thus the command
253 which prints the first few lines of a message could be used in
255 to print the first few lines of all messages.
256 .Ss "Replying To or Originating Mail"
260 set up a response to a message, sending it back to the
261 person who it was from.
262 Text you then type in, up to an end-of-file,
263 defines the contents of the message.
264 While you are composing a message,
266 treats lines beginning with the character
271 (alone on a line) will place a copy
272 of the current message into the response right shifting it by a tabstop
276 Other escapes will set up subject fields, add and delete recipients
277 to the message and allow you to escape to an editor to revise the
278 message or to a shell to run some commands.
280 are given in the summary below.)
281 .Ss "Ending a Mail Processing Session"
288 Messages which have been examined go to your
290 file unless they have been deleted in which case they are discarded.
291 Unexamined messages go back to the post office.
295 .Ss "Personal and System Wide Distribution Lists"
296 It is also possible to create a personal distribution lists so that,
297 for instance, you can send mail to
300 to a group of people.
301 Such lists can be defined by placing a line like
303 .Dl "alias cohorts bill ozalp jkf mark kridle@ucbcory"
307 in your home directory.
308 The current list of such aliases can be displayed with the
312 System wide distribution lists can be created by editing
313 .Pa /etc/mail/aliases ,
318 these are kept in a different syntax.
319 In mail you send, personal aliases will be expanded in mail sent
320 to others so that they will be able to
325 are not expanded when the mail is sent,
326 but any reply returned to the machine will have the system wide
327 alias expanded as all mail goes through
329 .Ss "Network Mail (ARPA, UUCP, Berknet)"
332 for a description of network addresses.
336 utility has a number of options which can be set in the
338 file to alter its behavior; thus
343 (These options are summarized below.)
346 .%T "Mail Reference Manual" . )
348 Each command is typed on a line by itself, and may take arguments
349 following the command word.
350 The command need not be typed in its
351 entirety \(em the first command which matches the typed prefix is used.
352 For commands which take message lists as arguments, if no message
353 list is given, then the next message forward which satisfies the
354 command's requirements is used.
355 If there are no messages forward of
356 the current message, the search proceeds backwards, and if there are no
357 good messages at all,
360 .Dq Li "No applicable messages"
363 .Bl -tag -width indent
365 Print out the preceding message.
371 previous message and prints it.
373 ignore the remainder of the line as a comment.
375 Prints a brief summary of commands.
382 command which follows.
387 but also prints out ignored header fields.
395 Does not reply to other
396 recipients of the original message.
404 With no arguments, prints out all currently-defined aliases.
406 argument, prints out that alias.
407 With more than one argument, creates
408 a new alias or changes an old one.
413 command is useful if you have accounts on several machines.
414 It can be used to inform
416 that the listed addresses are really you.
421 will not send a copy of the message to any of the addresses
427 command is given with no argument, the current set of alternative
431 Changes the user's working directory to that specified, if given.
433 no directory is given, then changes to the user's login directory.
438 command does the same thing that
440 does, except that it does not mark the messages it
441 is used on for deletion when you
445 Takes a list of messages as argument and marks them all as deleted.
446 Deleted messages will not be saved in
448 nor will they be available for most other commands.
452 Deletes the current message and prints the next message.
453 If there is no next message,
459 Takes a list of messages and points the text editor at each one in
461 On return from the editor, the message is read back in.
466 Effects an immediate return to the shell without
467 modifying the user's system mailbox, his
469 file, or his edit file in
476 List the names of the folders in your folder directory.
481 command switches to a new mail file or folder.
483 arguments, it tells you which file you are currently reading.
484 If you give it an argument, it will write out changes (such
485 as deletions) you have made in the current file and read in
487 Some special conventions are recognized for
490 means the previous file,
492 means your system mailbox,
494 means user's system mailbox,
499 .Dq Li + Ns Ar folder
500 means a file in your folder
504 Takes a list of messages and prints their message headers.
507 Lists the current range of headers, which is an 18-message group.
511 argument is given, then the next 18-message group is printed, and if
514 argument is given, the previous 18-message group is printed.
522 Takes a message list and marks each
523 message therein to be saved in the
524 user's system mailbox instead of in
526 Does not override the
530 Add the list of header fields named to the
532 Header fields in the ignore list are not printed
533 on your terminal when you print a message.
535 command is very handy for suppression of certain machine-generated
541 commands can be used to print a message in its entirety, including
545 is executed with no arguments, it lists the current set of
548 Incorporate any new messages that have arrived while mail
550 The new messages are added to the end of the message list,
551 and the current message is reset to be the first new mail message.
552 This does not renumber the existing message list, nor
553 does it cause any changes made so far to be saved.
556 Takes as argument login names and distribution group names and sends
557 mail to those people.
559 Indicate that a list of messages be sent to
561 in your home directory when you quit.
563 action for messages if you do
570 Takes a list of messages and invokes the pager on that list.
577 Goes to the next message in sequence and types it.
578 With an argument list, types the next matching message.
585 Takes a message list and types out each message on the user's terminal.
588 Terminates the session, saving all undeleted, unsaved messages in
591 file in his login directory, preserving all messages marked with
596 in his system mailbox, and removing all other messages from his system
598 If new mail has arrived during the session, the message
599 .Dq Li "You have new mail"
601 If given while editing a
602 mailbox file with the
604 flag, then the edit file is rewritten.
605 A return to the shell is
606 effected, unless the rewrite of edit file fails, in which case the user
612 Takes a message list and sends mail to the sender and all
613 recipients of the specified message.
614 The default message must not be deleted.
619 Add the list of header fields named to the
620 .Em "retained list" .
621 Only the header fields in the retained list
622 are shown on your terminal when you print a message.
623 All other header fields are suppressed.
628 commands can be used to print a message in its entirety.
631 is executed with no arguments, it lists the current set of
635 Takes a message list and a filename and appends each message in
636 turn to the end of the file.
637 The filename in quotes, followed by the line
638 count and character count is echoed on the user's terminal.
641 With no arguments, prints all variable values.
644 Arguments are of the form
645 .Ar option Ns Li = Ns Ar value
646 (no space before or after
650 Quotation marks may be placed around any part of the assignment statement to
651 quote blanks or tabs, i.e.\&
652 .Dq Li "set indentprefix=\*q->\*q"
663 Header fields thus marked are filtered out when
666 or when automatically saving to
678 Header fields thus marked are the only ones saved
679 with a message when saving by
681 or when automatically saving to
688 Invokes an interactive version of the shell.
690 Takes a message list and prints out the size in characters of each
696 commands from a file.
698 Takes a message list and prints the top few lines of each.
700 lines printed is controlled by the variable
708 Takes a list of names defined by
710 commands and discards the remembered groups of users.
712 no longer have any significance.
715 Takes a message list and marks each message as
720 Takes a message list and marks each message as
724 Takes a list of option names and discards their remembered values;
729 Takes a message list and invokes the display editor on each message.
738 the header) is saved.
739 Extremely useful for such tasks as sending and receiving source
740 program text over the message system.
748 utility presents message headers in windowfuls as described under the
753 attention forward to the next window with the
756 Also, you can move to the previous window by using
760 Here is a summary of the tilde escapes,
761 which are used when composing messages to perform
763 Tilde escapes are only recognized at the beginning
767 is somewhat of a misnomer since the actual escape character can be set
770 .Bl -tag -width indent
772 Inserts the autograph string from the sign= option into the message.
774 Inserts the autograph string from the Sign= option into the message.
775 .It Ic ~b Ar name ...
776 Add the given names to the list of carbon copy recipients but do not make
777 the names visible in the Cc: line
780 .It Ic ~c Ar name ...
781 Add the given names to the list of carbon copy recipients.
785 from your home directory into the message.
787 Invoke the text editor on the message collected so far.
789 editing session is finished, you may continue appending text to the
791 .It Ic ~f Ar messages
792 Read the named messages into the message being sent.
793 If no messages are specified, read in the current message.
794 Message headers currently being ignored (by the
798 command) are not included.
799 .It Ic ~F Ar messages
802 except all message headers are included.
804 Edit the message header fields by typing each one in turn and allowing
805 the user to append text to the end or modify the field by using the
806 current terminal erase and kill characters.
808 Inserts the value of the named option into the text of the message.
809 .It Ic ~m Ar messages
810 Read the named messages into the message being sent, indented by a
811 tab or by the value of
813 If no messages are specified,
814 read the current message.
815 Message headers currently being ignored (by the
819 command) are not included.
820 .It Ic ~M Ar messages
823 except all message headers are included.
825 Print out the message collected so far, prefaced by the message header
828 Abort the message being sent, copying the message to
830 in your home directory if
833 .It Ic ~r Ar filename , Ic ~r Li \&! Ns Ar command
834 .It Ic ~< Ar filename , Ic ~< Li \&! Ns Ar command
835 Read the named file into the message.
836 If the argument begins with a
838 the rest of the string is taken as an arbitrary system command and is
839 executed, with the standard output inserted into the message.
843 as the Reply-To field.
845 Cause the named string to become the current subject field.
846 .It Ic ~t Ar name ...
847 Add the given names to the direct recipient list.
849 Invoke an alternative editor (defined by the
851 environment variable) on the
852 message collected so far.
853 Usually, the alternative editor will be a
855 After you quit the editor, you may resume appending
856 text to the end of your message.
857 .It Ic ~w Ar filename
858 Write the message onto the named file.
862 except the message is not saved in
865 Execute the indicated shell command, then return to the message.
866 .It Ic ~| Ar command , Ic ~^ Ar command
867 Pipe the message through the command as a filter.
869 no output or terminates abnormally, retain the original text of the
875 to rejustify the message.
876 .It Ic ~: Ar mail-command , Ic ~_ Ar mail-command
880 Not all commands, however, are allowed.
882 Simulate end-of-file on input.
884 Print a summary of the available command escapes.
886 Insert the string of text in the message prefaced by a single
889 you have changed the escape character, then you should double
890 that character in order to send it.
893 Options can be set with the
896 and can be disabled with the
899 .Ic set Cm no Ns Ar name
901 Options may be either binary, in which case it is only
902 significant to see whether they are set or not; or string, in which
903 case the actual value is of interest.
904 If an option is not set,
906 will look for an environment variable of the same name.
907 The available options include the following:
908 .Bl -tag -width indent
910 Causes messages saved in
912 to be appended to the end rather than prepended.
913 This should always be set (preferably in one of the system-wide
921 to prompt you for the subject of each message you send.
923 you respond with simply a newline, no subject field will be sent.
927 Causes you to be prompted for additional blind carbon copy recipients at the
929 Responding with a newline indicates your
930 satisfaction with the current list.
934 Causes you to be prompted for additional carbon copy recipients at the
936 Responding with a newline indicates your
937 satisfaction with the current list.
941 Causes new mail to be automatically incorporated when it arrives.
942 Setting this is similar to issuing the
944 command at each prompt, except that the current message is not
945 reset when new mail arrives.
951 command to behave like
953 thus, after deleting a message, the next one will be typed
960 is used as a threshold to determine how long a message must
966 is set without a value,
967 then the height of the terminal screen stored in the system
968 is used to compute the threshold (see
973 Setting the binary option
975 is the same as specifying
977 on the command line and causes
979 to output all sorts of information useful for debugging
983 is invoked in this mode to send mail, all preparations
984 will be performed and reported about, but the mail will
985 not be actually sent.
993 to interpret a period alone on a line as the terminator
994 of a message you are sending.
998 If defined, the first character of this option gives the character to
1003 Reverses the sense of
1011 The name of the directory to use for storing folders of
1013 If this name begins with a
1016 considers it to be an absolute pathname; otherwise, the
1017 folder directory is found relative to your home directory.
1019 If defined, initially display message headers when reading mail or
1020 editing a mail folder.
1023 This option can be disabled by giving the
1025 flag on the command line.
1027 This option is used to hold messages in the system mailbox
1032 Causes interrupt signals from your terminal to be ignored and echoed as
1037 An option related to
1045 as the end of a message.
1055 tilde escape for indenting messages, in place of
1056 the normal tab character
1058 Be sure to quote the value if it contains
1061 Usually, when a group is expanded that contains the sender, the sender
1062 is removed from the expansion.
1063 Setting this option causes the sender
1064 to be included in the group.
1068 Suppresses the printing of the version when first invoked.
1072 If defined, gives the pathname of the file used to record all outgoing
1074 If not defined, outgoing mail is not saved.
1078 Reverses the sense of
1086 If this option is set, and you abort a message with two
1090 will copy the partial letter to the file
1092 in your home directory.
1095 .It Va searchheaders
1096 If this option is set, then a message-list specifier in the form
1097 .Dq Li / Ns Ar x Ns Li : Ns Ar y
1098 will expand to all messages containing the substring
1102 The string search is case insensitive.
1105 is omitted, it will default to the
1110 is a special case, and will expand
1111 to all messages containing the substring
1121 is case sensitive, so that
1123 can be used to limit the search for
1129 .Va nosearchheaders .
1131 If defined, gives the number of lines of a message to be printed out
1134 command; normally, the first five lines are printed.
1138 is the same as using the
1140 flag on the command line.
1143 runs in verbose mode,
1144 the actual delivery of messages is displayed on the user's
1150 .Bl -tag -width ".Ev REPLYTO"
1152 Pathname of the file to save partial messages to in case of interrupts
1157 Pathname of the text editor to use in the
1162 If not defined, then a default editor is used.
1164 Pathname of the user's home directory.
1166 Pathname of the directory lister to use in the
1172 Location of the user's mailbox.
1176 Pathname of file containing initial
1182 The name of the mailbox file.
1183 It can be the name of a folder.
1186 in the user's home directory.
1188 Pathname of the program to use in the
1193 The default paginator
1195 is used if this option is not defined.
1197 If set, will be used to initialize the Reply-To field for outgoing
1200 Pathname of the shell to use in the
1205 A default shell is used if this option is
1208 Pathname of the directory used for creating temporary files.
1210 Pathname of the text editor to use in the
1216 Login name of the user executing mail.
1219 .Bl -tag -width ".Pa /usr/share/misc/mail.*help" -compact
1228 This can be overridden by setting the
1230 environment variable.
1233 .It Pa /usr/share/misc/mail.*help
1236 .It Pa /usr/share/misc/mail.rc
1237 .It Pa /usr/local/etc/mail.rc
1239 System-wide initialization files.
1240 Each file will be sourced, in order,
1251 .%T "The Mail Reference Manual"
1259 This man page is derived from
1260 .%T "The Mail Reference Manual"
1261 originally written by
1264 There are some flags that are not documented here.
1266 not useful to the general user.
1274 which can be confusing.
1278 list is incorrect English (it should be
1279 .Dq alternatives ) ,
1280 but is retained for compatibility.