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 .\" 3. 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
29 .\" $FreeBSD: src/usr.bin/mail/mail.1,v 1.18.2.12 2003/01/06 05:46:03 mikeh Exp $
38 .Nd send and receive mail
47 .Op Fl Ar sendmail-option ...
65 utility is an intelligent mail processing system, which has
66 a command syntax reminiscent of
68 with lines replaced by messages.
70 The following options are available:
71 .Bl -tag -width indent
75 delivery are displayed on the user's terminal.
77 Test for the presence of mail in the (by default, system)
79 An exit status of 0 is returned if
80 it has mail; otherwise an exit status of 1 is returned.
82 Write a header summary only.
84 Do not send messages with an empty body.
85 This is useful for piping errors from
89 Ignore tty interrupt signals.
91 particularly useful when using
97 to run in interactive mode even when
98 input is not a terminal.
102 character when sending mail is only active in interactive mode.
104 Inhibit reading the system-wide
108 Inhibit the initial display of message headers
109 when reading mail or editing a mail folder.
114 (Only the first argument after the
116 flag is used as a subject; be careful to quote subjects
119 Send carbon copies to
124 argument should be a comma-separated list of names.
126 Send blind carbon copies to
131 argument should be a comma-separated list of names.
133 Read in the contents of your
135 (or the specified file)
136 for processing; when you
139 writes undeleted messages back to this file.
141 Record the message in a file named after the first recipient.
142 The name is the login-name portion of the
143 address found first on the
145 line in the mail header.
152 .Dl "mail -f /var/mail/user"
154 .Ss "Startup Actions"
157 will execute commands in the system command files
158 .Pa /usr/share/misc/mail.rc ,
159 .Pa /usr/local/etc/mail.rc
162 in order, unless explicitly told not to by the use of the
165 Next, the commands in the user's personal command file
170 utility then examines its command line options to determine whether a
171 new message is to be sent, or whether an existing mailbox is to
174 To send a message to one or more people,
176 can be invoked with arguments which are the names of people to
177 whom the mail will be sent.
178 You are then expected to type in
179 your message, followed
182 at the beginning of a line.
184 .Sx "Replying To or Originating Mail" ,
185 describes some features of
187 available to help you compose your letter.
191 is given no arguments and checks your mail out of the
193 prints out a one line header of each message found.
194 The current message is initially the first message (numbered 1)
195 and can be printed using the
197 command (which can be abbreviated
199 You can move among the messages much as you move between lines in
205 moving backwards and forwards, and
207 .Ss "Disposing of Mail"
208 After examining a message you can
217 program to forget about the message.
218 This is not irreversible; the message can be
221 by giving its number, or the
223 session can be aborted by giving the
227 Deleted messages will, however, usually disappear never to be seen again.
228 .Ss "Specifying Messages"
233 can be given a list of message numbers as arguments to apply
234 to a number of messages at once.
237 deletes messages 1 and 2, while
239 deletes messages 1 through 5.
242 addresses all messages, and
245 the last message; thus the command
247 which prints the first few lines of a message could be used in
249 to print the first few lines of all messages.
250 .Ss "Replying To or Originating Mail"
254 set up a response to a message, sending it back to the
255 person who it was from.
256 Text you then type in, up to an end-of-file,
257 defines the contents of the message.
258 While you are composing a message,
260 treats lines beginning with the character
265 (alone on a line) will place a copy
266 of the current message into the response right shifting it by a tabstop
270 Other escapes will set up subject fields, add and delete recipients
271 to the message and allow you to escape to an editor to revise the
272 message or to a shell to run some commands.
274 are given in the summary below.)
275 .Ss "Ending a Mail Processing Session"
282 Messages which have been examined go to your
284 file unless they have been deleted in which case they are discarded.
285 Unexamined messages go back to the post office.
289 .Ss "Personal and System Wide Distribution Lists"
290 It is also possible to create a personal distribution lists so that,
291 for instance, you can send mail to
294 to a group of people.
295 Such lists can be defined by placing a line like
297 .Dl "alias cohorts bill ozalp jkf mark kridle@ucbcory"
301 in your home directory.
302 The current list of such aliases can be displayed with the
306 System wide distribution lists can be created by editing
307 .Pa /etc/mail/aliases ,
312 these are kept in a different syntax.
313 In mail you send, personal aliases will be expanded in mail sent
314 to others so that they will be able to
319 are not expanded when the mail is sent,
320 but any reply returned to the machine will have the system wide
321 alias expanded as all mail goes through
323 .Ss "Network Mail (ARPA, UUCP, Berknet)"
326 utility has a number of options which can be set in the
328 file to alter its behavior; thus
333 (These options are summarized below.)
336 .%T "Mail Reference Manual" . )
338 Each command is typed on a line by itself, and may take arguments
339 following the command word.
340 The command need not be typed in its
341 entirety \(em the first command which matches the typed prefix is used.
342 For commands which take message lists as arguments, if no message
343 list is given, then the next message forward which satisfies the
344 command's requirements is used.
345 If there are no messages forward of
346 the current message, the search proceeds backwards, and if there are no
347 good messages at all,
350 .Dq Li "No applicable messages"
353 .Bl -tag -width indent
355 Print out the preceding message.
361 previous message and prints it.
363 ignore the remainder of the line as a comment.
365 Prints a brief summary of commands.
372 command which follows.
377 but also prints out ignored header fields.
385 Does not reply to other
386 recipients of the original message.
394 With no arguments, prints out all currently-defined aliases.
396 argument, prints out that alias.
397 With more than one argument, creates
398 a new alias or changes an old one.
403 command is useful if you have accounts on several machines.
404 It can be used to inform
406 that the listed addresses are really you.
411 will not send a copy of the message to any of the addresses
417 command is given with no argument, the current set of alternative
421 Changes the user's working directory to that specified, if given.
423 no directory is given, then changes to the user's login directory.
428 command does the same thing that
430 does, except that it does not mark the messages it
431 is used on for deletion when you
435 Takes a list of messages as argument and marks them all as deleted.
436 Deleted messages will not be saved in
438 nor will they be available for most other commands.
442 Deletes the current message and prints the next message.
443 If there is no next message,
449 Takes a list of messages and points the text editor at each one in
451 On return from the editor, the message is read back in.
456 Effects an immediate return to the shell without
457 modifying the user's system mailbox, his
459 file, or his edit file in
466 List the names of the folders in your folder directory.
471 command switches to a new mail file or folder.
473 arguments, it tells you which file you are currently reading.
474 If you give it an argument, it will write out changes (such
475 as deletions) you have made in the current file and read in
477 Some special conventions are recognized for
480 means the previous file,
482 means your system mailbox,
484 means user's system mailbox,
489 .Dq Li + Ns Ar folder
490 means a file in your folder
494 Takes a list of messages and prints their message headers.
497 Lists the current range of headers, which is an 18-message group.
501 argument is given, then the next 18-message group is printed, and if
504 argument is given, the previous 18-message group is printed.
512 Takes a message list and marks each
513 message therein to be saved in the
514 user's system mailbox instead of in
516 Does not override the
520 Add the list of header fields named to the
522 Header fields in the ignore list are not printed
523 on your terminal when you print a message.
525 command is very handy for suppression of certain machine-generated
531 commands can be used to print a message in its entirety, including
535 is executed with no arguments, it lists the current set of
538 Incorporate any new messages that have arrived while mail
540 The new messages are added to the end of the message list,
541 and the current message is reset to be the first new mail message.
542 This does not renumber the existing message list, nor
543 does it cause any changes made so far to be saved.
546 Takes as argument login names and distribution group names and sends
547 mail to those people.
549 Indicate that a list of messages be sent to
551 in your home directory when you quit.
553 action for messages if you do
560 Takes a list of messages and invokes the pager on that list.
567 Goes to the next message in sequence and types it.
568 With an argument list, types the next matching message.
575 Takes a message list and types out each message on the user's terminal.
578 Terminates the session, saving all undeleted, unsaved messages in
581 file in his login directory, preserving all messages marked with
586 in his system mailbox, and removing all other messages from his system
588 If new mail has arrived during the session, the message
589 .Dq Li "You have new mail"
591 If given while editing a
592 mailbox file with the
594 flag, then the edit file is rewritten.
595 A return to the shell is
596 effected, unless the rewrite of edit file fails, in which case the user
602 Takes a message list and sends mail to the sender and all
603 recipients of the specified message.
604 The default message must not be deleted.
609 Add the list of header fields named to the
610 .Em "retained list" .
611 Only the header fields in the retained list
612 are shown on your terminal when you print a message.
613 All other header fields are suppressed.
618 commands can be used to print a message in its entirety.
621 is executed with no arguments, it lists the current set of
625 Takes a message list and a filename and appends each message in
626 turn to the end of the file.
627 The filename in quotes, followed by the line
628 count and character count is echoed on the user's terminal.
631 With no arguments, prints all variable values.
634 Arguments are of the form
635 .Ar option Ns Li = Ns Ar value
636 (no space before or after
640 Quotation marks may be placed around any part of the assignment statement to
641 quote blanks or tabs, i.e.\&
642 .Dq Li "set indentprefix=\*q->\*q"
653 Header fields thus marked are filtered out when
656 or when automatically saving to
668 Header fields thus marked are the only ones saved
669 with a message when saving by
671 or when automatically saving to
678 Invokes an interactive version of the shell.
680 Takes a message list and prints out the size in characters of each
686 commands from a file.
688 Takes a message list and prints the top few lines of each.
690 lines printed is controlled by the variable
698 Takes a list of names defined by
700 commands and discards the remembered groups of users.
702 no longer have any significance.
705 Takes a message list and marks each message as
710 Takes a message list and marks each message as
714 Takes a list of option names and discards their remembered values;
719 Takes a message list and invokes the display editor on each message.
728 the header) is saved.
729 Extremely useful for such tasks as sending and receiving source
730 program text over the message system.
738 utility presents message headers in windowfuls as described under the
743 attention forward to the next window with the
746 Also, you can move to the previous window by using
750 Here is a summary of the tilde escapes,
751 which are used when composing messages to perform
753 Tilde escapes are only recognized at the beginning
757 is somewhat of a misnomer since the actual escape character can be set
760 .Bl -tag -width indent
762 Inserts the autograph string from the sign= option into the message.
764 Inserts the autograph string from the Sign= option into the message.
765 .It Ic ~b Ar name ...
766 Add the given names to the list of carbon copy recipients but do not make
767 the names visible in the Cc: line
770 .It Ic ~c Ar name ...
771 Add the given names to the list of carbon copy recipients.
775 from your home directory into the message.
777 Invoke the text editor on the message collected so far.
779 editing session is finished, you may continue appending text to the
781 .It Ic ~f Ar messages
782 Read the named messages into the message being sent.
783 If no messages are specified, read in the current message.
784 Message headers currently being ignored (by the
788 command) are not included.
789 .It Ic ~F Ar messages
792 except all message headers are included.
794 Edit the message header fields by typing each one in turn and allowing
795 the user to append text to the end or modify the field by using the
796 current terminal erase and kill characters.
798 Inserts the value of the named option into the text of the message.
799 .It Ic ~m Ar messages
800 Read the named messages into the message being sent, indented by a
801 tab or by the value of
803 If no messages are specified,
804 read the current message.
805 Message headers currently being ignored (by the
809 command) are not included.
810 .It Ic ~M Ar messages
813 except all message headers are included.
815 Print out the message collected so far, prefaced by the message header
818 Abort the message being sent, copying the message to
820 in your home directory if
823 .It Ic ~r Ar filename , Ic ~r Li \&! Ns Ar command
824 .It Ic ~< Ar filename , Ic ~< Li \&! Ns Ar command
825 Read the named file into the message.
826 If the argument begins with a
828 the rest of the string is taken as an arbitrary system command and is
829 executed, with the standard output inserted into the message.
833 as the Reply-To field.
835 Cause the named string to become the current subject field.
836 .It Ic ~t Ar name ...
837 Add the given names to the direct recipient list.
839 Invoke an alternative editor (defined by the
841 environment variable) on the
842 message collected so far.
843 Usually, the alternative editor will be a
845 After you quit the editor, you may resume appending
846 text to the end of your message.
847 .It Ic ~w Ar filename
848 Write the message onto the named file.
852 except the message is not saved in
855 Execute the indicated shell command, then return to the message.
856 .It Ic ~| Ar command , Ic ~^ Ar command
857 Pipe the message through the command as a filter.
859 no output or terminates abnormally, retain the original text of the
865 to rejustify the message.
866 .It Ic ~: Ar mail-command , Ic ~_ Ar mail-command
870 Not all commands, however, are allowed.
872 Simulate end-of-file on input.
874 Print a summary of the available command escapes.
876 Insert the string of text in the message prefaced by a single
879 you have changed the escape character, then you should double
880 that character in order to send it.
883 Options can be set with the
886 and can be disabled with the
889 .Ic set Cm no Ns Ar name
891 Options may be either binary, in which case it is only
892 significant to see whether they are set or not; or string, in which
893 case the actual value is of interest.
894 If an option is not set,
896 will look for an environment variable of the same name.
897 The available options include the following:
898 .Bl -tag -width indent
900 Causes messages saved in
902 to be appended to the end rather than prepended.
903 This should always be set (preferably in one of the system-wide
911 to prompt you for the subject of each message you send.
913 you respond with simply a newline, no subject field will be sent.
917 Causes you to be prompted for additional blind carbon copy recipients at the
919 Responding with a newline indicates your
920 satisfaction with the current list.
924 Causes you to be prompted for additional carbon copy recipients at the
926 Responding with a newline indicates your
927 satisfaction with the current list.
931 Causes new mail to be automatically incorporated when it arrives.
932 Setting this is similar to issuing the
934 command at each prompt, except that the current message is not
935 reset when new mail arrives.
941 command to behave like
943 thus, after deleting a message, the next one will be typed
950 is used as a threshold to determine how long a message must
956 is set without a value,
957 then the height of the terminal screen stored in the system
958 is used to compute the threshold (see
963 Setting the binary option
965 is the same as specifying
967 on the command line and causes
969 to output all sorts of information useful for debugging
978 to interpret a period alone on a line as the terminator
979 of a message you are sending.
983 If defined, the first character of this option gives the character to
988 Reverses the sense of
996 The name of the directory to use for storing folders of
998 If this name begins with a
1001 considers it to be an absolute pathname; otherwise, the
1002 folder directory is found relative to your home directory.
1004 If defined, initially display message headers when reading mail or
1005 editing a mail folder.
1008 This option can be disabled by giving the
1010 flag on the command line.
1012 This option is used to hold messages in the system mailbox
1017 Causes interrupt signals from your terminal to be ignored and echoed as
1022 An option related to
1030 as the end of a message.
1040 tilde escape for indenting messages, in place of
1041 the normal tab character
1043 Be sure to quote the value if it contains
1046 Usually, when a group is expanded that contains the sender, the sender
1047 is removed from the expansion.
1048 Setting this option causes the sender
1049 to be included in the group.
1053 Suppresses the printing of the version when first invoked.
1057 If defined, gives the pathname of the file used to record all outgoing
1059 If not defined, outgoing mail is not saved.
1063 Reverses the sense of
1071 If this option is set, and you abort a message with two
1075 will copy the partial letter to the file
1077 in your home directory.
1080 .It Va searchheaders
1081 If this option is set, then a message-list specifier in the form
1082 .Dq Li / Ns Ar x Ns Li : Ns Ar y
1083 will expand to all messages containing the substring
1087 The string search is case insensitive.
1090 is omitted, it will default to the
1095 is a special case, and will expand
1096 to all messages containing the substring
1106 is case sensitive, so that
1108 can be used to limit the search for
1114 .Va nosearchheaders .
1116 If defined, gives the number of lines of a message to be printed out
1119 command; normally, the first five lines are printed.
1123 is the same as using the
1125 flag on the command line.
1128 runs in verbose mode,
1129 the actual delivery of messages is displayed on the user's
1135 .Bl -tag -width ".Ev REPLYTO"
1137 Pathname of the file to save partial messages to in case of interrupts
1142 Pathname of the text editor to use in the
1147 If not defined, then a default editor is used.
1149 Pathname of the user's home directory.
1151 Pathname of the directory lister to use in the
1157 Location of the user's mailbox.
1161 Pathname of file containing initial
1167 The name of the mailbox file.
1168 It can be the name of a folder.
1171 in the user's home directory.
1173 Pathname of the program to use in the
1178 The default paginator
1180 is used if this option is not defined.
1182 If set, will be used to initialize the Reply-To field for outgoing
1185 Pathname of the shell to use in the
1190 A default shell is used if this option is
1193 Pathname of the text editor to use in the
1199 Login name of the user executing mail.
1202 .Bl -tag -width ".Pa /usr/share/misc/mail.*help" -compact
1211 This can be overridden by setting the
1213 environment variable.
1216 .It Pa /usr/share/misc/mail.*help
1219 .It Pa /usr/share/misc/mail.rc
1220 .It Pa /usr/local/etc/mail.rc
1222 System-wide initialization files.
1223 Each file will be sourced, in order,
1238 This man page is derived from
1239 .%T "The Mail Reference Manual"
1240 originally written by
1243 There are some flags that are not documented here.
1245 not useful to the general user.
1253 which can be confusing.
1257 list is incorrect English (it should be
1258 .Dq alternatives ) ,
1259 but is retained for compatibility.