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. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)mail.1 8.8 (Berkeley) 4/28/95
42 .Nd send and receive mail
51 .Op Fl Ar sendmail-option ...
68 utility is an intelligent mail processing system, which has
69 a command syntax reminiscent of
71 with lines replaced by messages.
73 The following options are available:
74 .Bl -tag -width indent
78 delivery are displayed on the user's terminal.
83 mail option for details.
85 Test for the presence of mail in the (by default, system)
87 An exit status of 0 is returned if
88 it has mail; otherwise, an exit status
91 Write a header summary only, then exit.
93 Do not send messages with an empty body.
94 This is useful for piping errors from
98 Ignore tty interrupt signals.
100 particularly useful when using
102 on noisy phone lines.
106 to run in interactive mode even when
107 input is not a terminal.
111 character when sending mail is only active in interactive mode.
113 Inhibit reading the system-wide
117 Inhibit the initial display of message headers
118 when reading mail or editing a mail folder.
123 (Only the first argument after the
125 flag is used as a subject; be careful to quote subjects
128 Send carbon copies to
133 argument should be a comma-separated list of names.
135 Send blind carbon copies to
140 argument should be a comma-separated list of names.
142 Read in the contents of your
144 (or the specified file)
145 for processing; when you
148 writes undeleted messages back to this file.
150 Record the message in a file named after the first
152 The name is the login-name portion of the
153 address found first on the
155 line in the mail header.
162 .Dl "mail -f /var/mail/user"
164 .Ss "Startup Actions"
167 will execute commands in the system command files
168 .Pa /usr/share/misc/mail.rc ,
169 .Pa /usr/local/etc/mail.rc
172 in order, unless explicitly told not to by the use of the
175 Next, the commands in the user's personal command file
180 utility then examines its command line options to determine whether a
181 new message is to be sent, or whether an existing mailbox is to
184 To send a message to one or more people,
186 can be invoked with arguments which are the names of people to
187 whom the mail will be sent.
188 You are then expected to type in
189 your message, followed
192 at the beginning of a line.
194 .Sx "Replying To or Originating Mail" ,
195 describes some features of
197 available to help you compose your letter.
201 is given no arguments and checks your mail out of the
203 prints out a one line header of each message found.
204 The current message is initially the first message (numbered 1)
205 and can be printed using the
207 command (which can be abbreviated
209 You can move among the messages much as you move between lines in
215 moving backwards and forwards, and
217 .Ss "Disposing of Mail"
218 After examining a message you can
227 program to forget about the message.
228 This is not irreversible; the message can be
231 by giving its number, or the
233 session can be aborted by giving the
237 Deleted messages will, however, usually disappear never to be seen again.
238 .Ss "Specifying Messages"
243 can be given a list of message numbers as arguments to apply
244 to a number of messages at once.
247 deletes messages 1 and 2, while
249 deletes messages 1 through 5.
252 addresses all messages, and
255 the last message; thus the command
257 which prints the first few lines of a message could be used in
259 to print the first few lines of all messages.
260 .Ss "Replying To or Originating Mail"
264 set up a response to a message, sending it back to the
265 person who it was from.
266 Text you then type in, up to an end-of-file,
267 defines the contents of the message.
268 While you are composing a message,
270 treats lines beginning with the character
275 (alone on a line) will place a copy
276 of the current message into the response right shifting it by a tabstop
280 Other escapes will set up subject fields, add and delete recipients
281 to the message and allow you to escape to an editor to revise the
282 message or to a shell to run some commands.
284 are given in the summary below.)
285 .Ss "Ending a Mail Processing Session"
292 Messages which have been examined go to your
294 file unless they have been deleted in which case they are discarded.
295 Unexamined messages go back to the post office.
299 .Ss "Personal and System Wide Distribution Lists"
300 It is also possible to create a personal distribution lists so that,
301 for instance, you can send mail to
304 to a group of people.
305 Such lists can be defined by placing a line like
307 .Dl "alias cohorts bill ozalp jkf mark kridle@ucbcory"
311 in your home directory.
312 The current list of such aliases can be displayed with the
316 System wide distribution lists can be created by editing
317 .Pa /etc/mail/aliases ,
322 these are kept in a different syntax.
323 In mail you send, personal aliases will be expanded in mail sent
324 to others so that they will be able to
329 are not expanded when the mail is sent,
330 but any reply returned to the machine will have the system wide
331 alias expanded as all mail goes through
333 .Ss "Network Mail (ARPA, UUCP, Berknet)"
336 for a description of network addresses.
340 utility has a number of options which can be set in the
342 file to alter its behavior; thus
347 (These options are summarized below.)
350 .%T "Mail Reference Manual" . )
352 Each command is typed on a line by itself, and may take arguments
353 following the command word.
354 The command need not be typed in its
355 entirety \(em the first command which matches the typed prefix is used.
356 For commands which take message lists as arguments, if no message
357 list is given, then the next message forward which satisfies the
358 command's requirements is used.
359 If there are no messages forward of
360 the current message, the search proceeds backwards, and if there are no
361 good messages at all,
364 .Dq Li "No applicable messages"
367 .Bl -tag -width indent
369 Print out the preceding message.
375 previous message and prints it.
377 ignore the remainder of the line as a comment.
379 Prints a brief summary of commands.
386 command which follows.
391 but also prints out ignored header fields.
399 Does not reply to other
400 recipients of the original message.
408 With no arguments, prints out all currently-defined aliases.
410 argument, prints out that alias.
411 With more than one argument, creates
412 a new alias or changes an old one.
417 command is useful if you have accounts on several machines.
418 It can be used to inform
420 that the listed addresses are really you.
425 will not send a copy of the message to any of the addresses
431 command is given with no argument, the current set of alternative
435 Changes the user's working directory to that specified, if given.
437 no directory is given, then changes to the user's login directory.
442 command does the same thing that
444 does, except that it does not mark the messages it
445 is used on for deletion when you
449 Takes a list of messages as argument and marks them all as deleted.
450 Deleted messages will not be saved in
452 nor will they be available for most other commands.
456 Deletes the current message and prints the next message.
457 If there is no next message,
463 Takes a list of messages and points the text editor at each one in
465 On return from the editor, the message is read back in.
470 Effects an immediate return to the shell without
471 modifying the user's system mailbox, his
473 file, or his edit file in
480 List the names of the folders in your folder directory.
485 command switches to a new mail file or folder.
487 arguments, it tells you which file you are currently reading.
488 If you give it an argument, it will write out changes (such
489 as deletions) you have made in the current file and read in
491 Some special conventions are recognized for
494 means the previous file,
496 means your system mailbox,
498 means user's system mailbox,
503 .Dq Li + Ns Ar folder
504 means a file in your folder
508 Takes a list of messages and prints their message headers.
511 Lists the current range of headers, which is an 18-message group.
515 argument is given, then the next 18-message group is printed, and if
518 argument is given, the previous 18-message group is printed.
526 Takes a message list and marks each
527 message therein to be saved in the
528 user's system mailbox instead of in
530 Does not override the
534 Add the list of header fields named to the
536 Header fields in the ignore list are not printed
537 on your terminal when you print a message.
539 command is very handy for suppression of certain machine-generated
545 commands can be used to print a message in its entirety, including
549 is executed with no arguments, it lists the current set of
552 Incorporate any new messages that have arrived while mail
554 The new messages are added to the end of the message list,
555 and the current message is reset to be the first new mail message.
556 This does not renumber the existing message list, nor
557 does it cause any changes made so far to be saved.
560 Takes as argument login names and distribution group names and sends
561 mail to those people.
563 Indicate that a list of messages be sent to
565 in your home directory when you quit.
567 action for messages if you do
574 Takes a list of messages and invokes the pager on that list.
581 Goes to the next message in sequence and types it.
582 With an argument list, types the next matching message.
589 Takes a message list and types out each message on the user's terminal.
592 Terminates the session, saving all undeleted, unsaved messages in
595 file in his login directory, preserving all messages marked with
600 in his system mailbox, and removing all other messages from his system
602 If new mail has arrived during the session, the message
603 .Dq Li "You have new mail"
605 If given while editing a
606 mailbox file with the
608 flag, then the edit file is rewritten.
609 A return to the shell is
610 effected, unless the rewrite of edit file fails, in which case the user
616 Takes a message list and sends mail to the sender and all
617 recipients of the specified message.
618 The default message must not be deleted.
623 Add the list of header fields named to the
624 .Em "retained list" .
625 Only the header fields in the retained list
626 are shown on your terminal when you print a message.
627 All other header fields are suppressed.
632 commands can be used to print a message in its entirety.
635 is executed with no arguments, it lists the current set of
639 Takes a message list and a filename and appends each message in
640 turn to the end of the file.
641 The filename in quotes, followed by the line
642 count and character count is echoed on the user's terminal.
645 With no arguments, prints all variable values.
648 Arguments are of the form
649 .Ar option Ns Li = Ns Ar value
650 (no space before or after
654 Quotation marks may be placed around any part of the assignment statement to
655 quote blanks or tabs, i.e.\&
656 .Dq Li "set indentprefix=\*q->\*q"
667 Header fields thus marked are filtered out when
670 or when automatically saving to
682 Header fields thus marked are the only ones saved
683 with a message when saving by
685 or when automatically saving to
692 Invokes an interactive version of the shell.
694 Takes a message list and prints out the size in characters of each
700 commands from a file.
702 Takes a message list and prints the top few lines of each.
704 lines printed is controlled by the variable
712 Takes a list of names defined by
714 commands and discards the remembered groups of users.
716 no longer have any significance.
719 Takes a message list and marks each message as
724 Takes a message list and marks each message as
728 Takes a list of option names and discards their remembered values;
733 Takes a message list and invokes the display editor on each message.
742 the header) is saved.
743 Extremely useful for such tasks as sending and receiving source
744 program text over the message system.
752 utility presents message headers in windowfuls as described under the
757 attention forward to the next window with the
760 Also, you can move to the previous window by using
764 Here is a summary of the tilde escapes,
765 which are used when composing messages to perform
767 Tilde escapes are only recognized at the beginning
771 is somewhat of a misnomer since the actual escape character can be set
774 .Bl -tag -width indent
776 Inserts the autograph string from the sign= option into the message.
778 Inserts the autograph string from the Sign= option into the message.
779 .It Ic ~b Ar name ...
780 Add the given names to the list of carbon copy recipients but do not make
781 the names visible in the Cc: line
784 .It Ic ~c Ar name ...
785 Add the given names to the list of carbon copy recipients.
789 from your home directory into the message.
791 Invoke the text editor on the message collected so far.
793 editing session is finished, you may continue appending text to the
795 .It Ic ~f Ar messages
796 Read the named messages into the message being sent.
797 If no messages are specified, read in the current message.
798 Message headers currently being ignored (by the
802 command) are not included.
803 .It Ic ~F Ar messages
806 except all message headers are included.
808 Edit the message header fields by typing each one in turn and allowing
809 the user to append text to the end or modify the field by using the
810 current terminal erase and kill characters.
812 Inserts the value of the named option into the text of the message.
813 .It Ic ~m Ar messages
814 Read the named messages into the message being sent, indented by a
815 tab or by the value of
817 If no messages are specified,
818 read the current message.
819 Message headers currently being ignored (by the
823 command) are not included.
824 .It Ic ~M Ar messages
827 except all message headers are included.
829 Print out the message collected so far, prefaced by the message header
832 Abort the message being sent, copying the message to
834 in your home directory if
837 .It Ic ~r Ar filename , Ic ~r Li \&! Ns Ar command
838 .It Ic ~< Ar filename , Ic ~< Li \&! Ns Ar command
839 Read the named file into the message.
840 If the argument begins with a
842 the rest of the string is taken as an arbitrary system command and is
843 executed, with the standard output inserted into the message.
847 as the Reply-To field.
849 Cause the named string to become the current subject field.
850 .It Ic ~t Ar name ...
851 Add the given names to the direct recipient list.
853 Invoke an alternative editor (defined by the
855 environment variable) on the
856 message collected so far.
857 Usually, the alternative editor will be a
859 After you quit the editor, you may resume appending
860 text to the end of your message.
861 .It Ic ~w Ar filename
862 Write the message onto the named file.
866 except the message is not saved in
869 Execute the indicated shell command, then return to the message.
870 .It Ic ~| Ar command , Ic ~^ Ar command
871 Pipe the message through the command as a filter.
873 no output or terminates abnormally, retain the original text of the
879 to rejustify the message.
880 .It Ic ~: Ar mail-command , Ic ~_ Ar mail-command
884 Not all commands, however, are allowed.
886 Simulate end-of-file on input.
888 Print a summary of the available command escapes.
890 Insert the string of text in the message prefaced by a single
893 you have changed the escape character, then you should double
894 that character in order to send it.
897 Options can be set with the
900 and can be disabled with the
903 .Ic set Cm no Ns Ar name
905 Options may be either binary, in which case it is only
906 significant to see whether they are set or not; or string, in which
907 case the actual value is of interest.
908 If an option is not set,
910 will look for an environment variable of the same name.
911 The available options include the following:
912 .Bl -tag -width indent
914 Causes messages saved in
916 to be appended to the end rather than prepended.
917 This should always be set (preferably in one of the system-wide
925 to prompt you for the subject of each message you send.
927 you respond with simply a newline, no subject field will be sent.
931 Causes you to be prompted for additional blind carbon copy recipients at the
933 Responding with a newline indicates your
934 satisfaction with the current list.
938 Causes you to be prompted for additional carbon copy recipients at the
940 Responding with a newline indicates your
941 satisfaction with the current list.
945 Causes new mail to be automatically incorporated when it arrives.
946 Setting this is similar to issuing the
948 command at each prompt, except that the current message is not
949 reset when new mail arrives.
955 command to behave like
957 thus, after deleting a message, the next one will be typed
964 is used as a threshold to determine how long a message must
970 is set without a value,
971 then the height of the terminal screen stored in the system
972 is used to compute the threshold (see
977 Setting the binary option
979 is the same as specifying
981 on the command line and causes
983 to output all sorts of information useful for debugging
987 is invoked in this mode to send mail, all preparations
988 will be performed and reported about, but the mail will
989 not be actually sent.
997 to interpret a period alone on a line as the terminator
998 of a message you are sending.
1002 If defined, the first character of this option gives the character to
1007 Reverses the sense of
1015 The name of the directory to use for storing folders of
1017 If this name begins with a
1020 considers it to be an absolute pathname; otherwise, the
1021 folder directory is found relative to your home directory.
1023 If defined, initially display message headers when reading mail or
1024 editing a mail folder.
1027 This option can be disabled by giving the
1029 flag on the command line.
1031 This option is used to hold messages in the system mailbox
1036 Causes interrupt signals from your terminal to be ignored and echoed as
1041 An option related to
1049 as the end of a message.
1059 tilde escape for indenting messages, in place of
1060 the normal tab character
1062 Be sure to quote the value if it contains
1065 Usually, when a group is expanded that contains the sender, the sender
1066 is removed from the expansion.
1067 Setting this option causes the sender
1068 to be included in the group.
1072 Suppresses the printing of the version when first invoked.
1076 If defined, gives the pathname of the file used to record all outgoing
1078 If not defined, outgoing mail is not saved.
1082 Reverses the sense of
1090 If this option is set, and you abort a message with two
1094 will copy the partial letter to the file
1096 in your home directory.
1099 .It Va searchheaders
1100 If this option is set, then a message-list specifier in the form
1101 .Dq Li / Ns Ar x Ns Li : Ns Ar y
1102 will expand to all messages containing the substring
1106 The string search is case insensitive.
1109 is omitted, it will default to the
1114 is a special case, and will expand
1115 to all messages containing the substring
1125 is case sensitive, so that
1127 can be used to limit the search for
1133 .Va nosearchheaders .
1135 If defined, gives the number of lines of a message to be printed out
1138 command; normally, the first five lines are printed.
1142 is the same as using the
1144 flag on the command line.
1147 runs in verbose mode,
1148 the actual delivery of messages is displayed on the user's
1154 .Bl -tag -width ".Ev REPLYTO"
1156 Pathname of the file to save partial messages to in case of interrupts
1161 Pathname of the text editor to use in the
1166 If not defined, then a default editor is used.
1168 Pathname of the user's home directory.
1170 Pathname of the directory lister to use in the
1176 Location of the user's mailbox.
1180 Pathname of file containing initial
1186 The name of the mailbox file.
1187 It can be the name of a folder.
1190 in the user's home directory.
1192 Pathname of the program to use in the
1197 The default paginator
1199 is used if this option is not defined.
1201 If set, will be used to initialize the Reply-To field for outgoing
1204 Pathname of the shell to use in the
1209 A default shell is used if this option is
1212 Pathname of the directory used for creating temporary files.
1214 Pathname of the text editor to use in the
1220 Login name of the user executing mail.
1223 .Bl -tag -width ".Pa /usr/share/misc/mail.*help" -compact
1232 This can be overridden by setting the
1234 environment variable.
1237 .It Pa /usr/share/misc/mail.*help
1240 .It Pa /usr/share/misc/mail.rc
1241 .It Pa /usr/local/etc/mail.rc
1243 System-wide initialization files.
1244 Each file will be sourced, in order,
1255 .%T "The Mail Reference Manual"
1263 This man page is derived from
1264 .%T "The Mail Reference Manual"
1265 originally written by
1268 There are some flags that are not documented here.
1270 not useful to the general user.
1278 which can be confusing.
1282 list is incorrect English (it should be
1283 .Dq alternatives ) ,
1284 but is retained for compatibility.