]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - usr.bin/mail/mail.1
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / usr.bin / mail / mail.1
1 .\" Copyright (c) 1980, 1990, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
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.
15 .\"
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
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     @(#)mail.1      8.8 (Berkeley) 4/28/95
29 .\" $FreeBSD$
30 .\"
31 .Dd January 5, 2006
32 .Dt MAIL 1
33 .Os
34 .Sh NAME
35 .Nm mail ,
36 .Nm Mail ,
37 .Nm mailx
38 .Nd send and receive mail
39 .Sh SYNOPSIS
40 .Nm
41 .Op Fl dEiInv
42 .Op Fl s Ar subject
43 .Op Fl c Ar cc-addr
44 .Op Fl b Ar bcc-addr
45 .Op Fl F
46 .Ar to-addr ...
47 .Op Fl Ar sendmail-option ...
48 .Nm
49 .Op Fl dEHiInNv
50 .Op Fl F
51 .Fl f
52 .Op Ar name
53 .Nm
54 .Op Fl dEHiInNv
55 .Op Fl F
56 .Op Fl u Ar user
57 .Nm
58 .Op Fl d
59 .Fl e
60 .Op Fl f Ar name
61 .Sh INTRODUCTION
62 The
63 .Nm
64 utility is an intelligent mail processing system, which has
65 a command syntax reminiscent of
66 .Xr ed 1
67 with lines replaced by messages.
68 .Pp
69 The following options are available:
70 .Bl -tag -width indent
71 .It Fl v
72 Verbose mode.
73 The details of
74 delivery are displayed on the user's terminal.
75 .It Fl d
76 Debugging mode.
77 See the
78 .Va debug
79 mail option for details.
80 .It Fl e
81 Test for the presence of mail in the (by default, system)
82 mailbox.
83 An exit status of 0 is returned if
84 it has mail; otherwise, an exit status
85 of 1 is returned.
86 .It Fl H
87 Write a header summary only, then exit.
88 .It Fl E
89 Do not send messages with an empty body.
90 This is useful for piping errors from
91 .Xr cron 8
92 scripts.
93 .It Fl i
94 Ignore tty interrupt signals.
95 This is
96 particularly useful when using
97 .Nm
98 on noisy phone lines.
99 .It Fl I
100 Force
101 .Nm
102 to run in interactive mode even when
103 input is not a terminal.
104 In particular, the
105 .Ql ~
106 special
107 character when sending mail is only active in interactive mode.
108 .It Fl n
109 Inhibit reading the system-wide
110 .Pa mail.rc
111 files upon startup.
112 .It Fl N
113 Inhibit the initial display of message headers
114 when reading mail or editing a mail folder.
115 .It Fl s Ar subject
116 Specify
117 .Ar subject
118 on command line.
119 (Only the first argument after the
120 .Fl s
121 flag is used as a subject; be careful to quote subjects
122 containing spaces.)
123 .It Fl c Ar cc-addr
124 Send carbon copies to
125 .Ar cc-addr
126 list of users.
127 The
128 .Ar cc-addr
129 argument should be a comma-separated list of names.
130 .It Fl b Ar bcc-addr
131 Send blind carbon copies to
132 .Ar bcc-addr
133 list of users.
134 The
135 .Ar bcc-addr
136 argument should be a comma-separated list of names.
137 .It Fl f Op Ar mbox
138 Read in the contents of your
139 .Pa mbox
140 (or the specified file)
141 for processing; when you
142 .Ic quit ,
143 .Nm
144 writes undeleted messages back to this file.
145 .It Fl F
146 Record the message in a file named after the first
147 recipient.
148 The name is the login-name portion of the
149 address found first on the
150 .Dq Li To:
151 line in the mail header.
152 Overrides the
153 .Va record
154 variable, if set.
155 .It Fl u Ar user
156 Is equivalent to:
157 .Pp
158 .Dl "mail -f /var/mail/user"
159 .El
160 .Ss "Startup Actions"
161 At startup time
162 .Nm
163 will execute commands in the system command files
164 .Pa /usr/share/misc/mail.rc ,
165 .Pa /usr/local/etc/mail.rc
166 and
167 .Pa /etc/mail.rc
168 in order, unless explicitly told not to by the use of the
169 .Fl n
170 option.
171 Next, the commands in the user's personal command file
172 .Pa ~/.mailrc
173 are executed.
174 The
175 .Nm
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
178 be read.
179 .Ss "Sending Mail"
180 To send a message to one or more people,
181 .Nm
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
186 by a
187 .Aq Li control-D
188 at the beginning of a line.
189 The section below
190 .Sx "Replying To or Originating Mail" ,
191 describes some features of
192 .Nm
193 available to help you compose your letter.
194 .Ss "Reading Mail"
195 In normal usage
196 .Nm
197 is given no arguments and checks your mail out of the
198 post office, then
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
202 .Ic print
203 command (which can be abbreviated
204 .Ic p ) .
205 You can move among the messages much as you move between lines in
206 .Xr ed 1 ,
207 with the commands
208 .Ic +
209 and
210 .Ic \-
211 moving backwards and forwards, and
212 simple numbers.
213 .Ss "Disposing of Mail"
214 After examining a message you can
215 .Ic delete
216 .Pq Ic d
217 the message or
218 .Ic reply
219 .Pq Ic r
220 to it.
221 Deletion causes the
222 .Nm
223 program to forget about the message.
224 This is not irreversible; the message can be
225 .Ic undeleted
226 .Pq Ic u
227 by giving its number, or the
228 .Nm
229 session can be aborted by giving the
230 .Ic exit
231 .Pq Ic x
232 command.
233 Deleted messages will, however, usually disappear never to be seen again.
234 .Ss "Specifying Messages"
235 Commands such as
236 .Ic print
237 and
238 .Ic delete
239 can be given a list of message numbers as arguments to apply
240 to a number of messages at once.
241 Thus
242 .Dq Li "delete 1 2"
243 deletes messages 1 and 2, while
244 .Dq Li "delete 1\-5"
245 deletes messages 1 through 5.
246 The special name
247 .Ql *
248 addresses all messages, and
249 .Ql $
250 addresses
251 the last message; thus the command
252 .Ic top
253 which prints the first few lines of a message could be used in
254 .Dq Li "top *"
255 to print the first few lines of all messages.
256 .Ss "Replying To or Originating Mail"
257 You can use the
258 .Ic reply
259 command to
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,
265 .Nm
266 treats lines beginning with the character
267 .Ql ~
268 specially.
269 For instance, typing
270 .Ic ~m
271 (alone on a line) will place a copy
272 of the current message into the response right shifting it by a tabstop
273 (see
274 .Va indentprefix
275 variable, below).
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.
279 (These options
280 are given in the summary below.)
281 .Ss "Ending a Mail Processing Session"
282 You can end a
283 .Nm
284 session with the
285 .Ic quit
286 .Pq Ic q
287 command.
288 Messages which have been examined go to your
289 .Pa mbox
290 file unless they have been deleted in which case they are discarded.
291 Unexamined messages go back to the post office.
292 (See the
293 .Fl f
294 option above).
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
298 .Dq Li cohorts
299 and have it go
300 to a group of people.
301 Such lists can be defined by placing a line like
302 .Pp
303 .Dl "alias cohorts bill ozalp jkf mark kridle@ucbcory"
304 .Pp
305 in the file
306 .Pa .mailrc
307 in your home directory.
308 The current list of such aliases can be displayed with the
309 .Ic alias
310 command in
311 .Nm .
312 System wide distribution lists can be created by editing
313 .Pa /etc/mail/aliases ,
314 see
315 .Xr aliases 5
316 and
317 .Xr sendmail 8 ;
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
321 .Ic reply
322 to the recipients.
323 System wide
324 aliases
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
328 .Xr sendmail 8 .
329 .Ss "Network Mail (ARPA, UUCP, Berknet)"
330 See
331 .Xr mailaddr 7
332 for a description of network addresses.
333 .Pp
334 The
335 .Nm
336 utility has a number of options which can be set in the
337 .Pa .mailrc
338 file to alter its behavior; thus
339 .Dq Li "set askcc"
340 enables the
341 .Va askcc
342 feature.
343 (These options are summarized below.)
344 .Sh SUMMARY
345 (Adapted from the
346 .%T "Mail Reference Manual" . )
347 .Pp
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,
358 .Nm
359 types
360 .Dq Li "No applicable messages"
361 and
362 aborts the command.
363 .Bl -tag -width indent
364 .It Ic \-
365 Print out the preceding message.
366 If given a numeric
367 argument
368 .Ar n ,
369 goes to the
370 .Ar n Ns 'th
371 previous message and prints it.
372 .It Ic #
373 ignore the remainder of the line as a comment.
374 .It Ic \&?
375 Prints a brief summary of commands.
376 .It Ic \&!
377 Executes the shell
378 (see
379 .Xr sh 1
380 and
381 .Xr csh 1 )
382 command which follows.
383 .It Ic Print
384 .Pq Ic P
385 Like
386 .Ic print
387 but also prints out ignored header fields.
388 See also
389 .Ic print , ignore
390 and
391 .Ic retain .
392 .It Ic Reply
393 .Pq Ic R
394 Reply to originator.
395 Does not reply to other
396 recipients of the original message.
397 .It Ic Type
398 .Pq Ic T
399 Identical to the
400 .Ic Print
401 command.
402 .It Ic alias
403 .Pq Ic a
404 With no arguments, prints out all currently-defined aliases.
405 With one
406 argument, prints out that alias.
407 With more than one argument, creates
408 a new alias or changes an old one.
409 .It Ic alternates
410 .Pq Ic alt
411 The
412 .Ic alternates
413 command is useful if you have accounts on several machines.
414 It can be used to inform
415 .Nm
416 that the listed addresses are really you.
417 When you
418 .Ic reply
419 to messages,
420 .Nm
421 will not send a copy of the message to any of the addresses
422 listed on the
423 .Ic alternates
424 list.
425 If the
426 .Ic alternates
427 command is given with no argument, the current set of alternative
428 names is displayed.
429 .It Ic chdir
430 .Pq Ic c
431 Changes the user's working directory to that specified, if given.
432 If
433 no directory is given, then changes to the user's login directory.
434 .It Ic copy
435 .Pq Ic co
436 The
437 .Ic copy
438 command does the same thing that
439 .Ic save
440 does, except that it does not mark the messages it
441 is used on for deletion when you
442 .Ic quit .
443 .It Ic delete
444 .Pq Ic d
445 Takes a list of messages as argument and marks them all as deleted.
446 Deleted messages will not be saved in
447 .Pa mbox ,
448 nor will they be available for most other commands.
449 .It Ic dp
450 (also
451 .Ic dt )
452 Deletes the current message and prints the next message.
453 If there is no next message,
454 .Nm
455 says
456 .Dq Li "at EOF" .
457 .It Ic edit
458 .Pq Ic e
459 Takes a list of messages and points the text editor at each one in
460 turn.
461 On return from the editor, the message is read back in.
462 .It Ic exit
463 .Ic ( ex
464 or
465 .Ic x )
466 Effects an immediate return to the shell without
467 modifying the user's system mailbox, his
468 .Pa mbox
469 file, or his edit file in
470 .Fl f .
471 .It Ic file
472 .Pq Ic fi
473 The same as
474 .Ic folder .
475 .It Ic folders
476 List the names of the folders in your folder directory.
477 .It Ic folder
478 .Pq Ic fo
479 The
480 .Ic folder
481 command switches to a new mail file or folder.
482 With no
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
486 the new file.
487 Some special conventions are recognized for
488 the name.
489 .Ql #
490 means the previous file,
491 .Ql %
492 means your system mailbox,
493 .Dq Li % Ns Ar user
494 means user's system mailbox,
495 .Ql &
496 means your
497 .Pa mbox
498 file, and
499 .Dq Li + Ns Ar folder
500 means a file in your folder
501 directory.
502 .It Ic from
503 .Pq Ic f
504 Takes a list of messages and prints their message headers.
505 .It Ic headers
506 .Pq Ic h
507 Lists the current range of headers, which is an 18-message group.
508 If
509 a
510 .Ql +
511 argument is given, then the next 18-message group is printed, and if
512 a
513 .Ql \-
514 argument is given, the previous 18-message group is printed.
515 .It Ic help
516 A synonym for
517 .Ic \&? .
518 .It Ic hold
519 .Ic ( ho ,
520 also
521 .Ic preserve )
522 Takes a message list and marks each
523 message therein to be saved in the
524 user's system mailbox instead of in
525 .Pa mbox .
526 Does not override the
527 .Ic delete
528 command.
529 .It Ic ignore
530 Add the list of header fields named to the
531 .Ar ignored list .
532 Header fields in the ignore list are not printed
533 on your terminal when you print a message.
534 This
535 command is very handy for suppression of certain machine-generated
536 header fields.
537 The
538 .Ic Type
539 and
540 .Ic Print
541 commands can be used to print a message in its entirety, including
542 ignored fields.
543 If
544 .Ic ignore
545 is executed with no arguments, it lists the current set of
546 ignored fields.
547 .It Ic inc
548 Incorporate any new messages that have arrived while mail
549 is being read.
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.
554 .It Ic mail
555 .Pq Ic m
556 Takes as argument login names and distribution group names and sends
557 mail to those people.
558 .It Ic mbox
559 Indicate that a list of messages be sent to
560 .Pa mbox
561 in your home directory when you quit.
562 This is the default
563 action for messages if you do
564 .Em not
565 have the
566 .Ic hold
567 option set.
568 .It Ic more
569 .Pq Ic mo
570 Takes a list of messages and invokes the pager on that list.
571 .It Ic next
572 .Ic ( n ,
573 like
574 .Ic +
575 or
576 .Tn CR )
577 Goes to the next message in sequence and types it.
578 With an argument list, types the next matching message.
579 .It Ic preserve
580 .Pq Ic pre
581 A synonym for
582 .Ic hold .
583 .It Ic print
584 .Pq Ic p
585 Takes a message list and types out each message on the user's terminal.
586 .It Ic quit
587 .Pq Ic q
588 Terminates the session, saving all undeleted, unsaved messages in
589 the user's
590 .Pa mbox
591 file in his login directory, preserving all messages marked with
592 .Ic hold
593 or
594 .Ic preserve
595 or never referenced
596 in his system mailbox, and removing all other messages from his system
597 mailbox.
598 If new mail has arrived during the session, the message
599 .Dq Li "You have new mail"
600 is given.
601 If given while editing a
602 mailbox file with the
603 .Fl f
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
607 can escape with the
608 .Ic exit
609 command.
610 .It Ic reply
611 .Pq Ic r
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.
615 .It Ic respond
616 A synonym for
617 .Ic reply .
618 .It Ic retain
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.
624 The
625 .Ic type
626 and
627 .Ic print
628 commands can be used to print a message in its entirety.
629 If
630 .Ic retain
631 is executed with no arguments, it lists the current set of
632 retained fields.
633 .It Ic save
634 .Pq Ic s
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.
639 .It Ic set
640 .Pq Ic se
641 With no arguments, prints all variable values.
642 Otherwise, sets
643 option.
644 Arguments are of the form
645 .Ar option Ns Li = Ns Ar value
646 (no space before or after
647 .Ql = )
648 or
649 .Ar option .
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"
653 .It Ic saveignore
654 .Ic Saveignore
655 is to
656 .Ic save
657 what
658 .Ic ignore
659 is to
660 .Ic print
661 and
662 .Ic type .
663 Header fields thus marked are filtered out when
664 saving a message by
665 .Ic save
666 or when automatically saving to
667 .Pa mbox .
668 .It Ic saveretain
669 .Ic Saveretain
670 is to
671 .Ic save
672 what
673 .Ic retain
674 is to
675 .Ic print
676 and
677 .Ic type .
678 Header fields thus marked are the only ones saved
679 with a message when saving by
680 .Ic save
681 or when automatically saving to
682 .Pa mbox .
683 .Ic Saveretain
684 overrides
685 .Ic saveignore .
686 .It Ic shell
687 .Pq Ic sh
688 Invokes an interactive version of the shell.
689 .It Ic size
690 Takes a message list and prints out the size in characters of each
691 message.
692 .It Ic source
693 The
694 .Ic source
695 command reads
696 commands from a file.
697 .It Ic top
698 Takes a message list and prints the top few lines of each.
699 The number of
700 lines printed is controlled by the variable
701 .Va toplines
702 and defaults to 5.
703 .It Ic type
704 .Pq Ic t
705 A synonym for
706 .Ic print .
707 .It Ic unalias
708 Takes a list of names defined by
709 .Ic alias
710 commands and discards the remembered groups of users.
711 The group names
712 no longer have any significance.
713 .It Ic undelete
714 .Pq Ic u
715 Takes a message list and marks each message as
716 .Em not
717 being deleted.
718 .It Ic unread
719 .Pq Ic U
720 Takes a message list and marks each message as
721 .Em not
722 having been read.
723 .It Ic unset
724 Takes a list of option names and discards their remembered values;
725 the inverse of
726 .Ic set .
727 .It Ic visual
728 .Pq Ic v
729 Takes a message list and invokes the display editor on each message.
730 .It Ic write
731 .Pq Ic w
732 Similar to
733 .Ic save ,
734 except that
735 .Em only
736 the message body
737 .Em ( without
738 the header) is saved.
739 Extremely useful for such tasks as sending and receiving source
740 program text over the message system.
741 .It Ic xit
742 .Pq Ic x
743 A synonym for
744 .Ic exit .
745 .It Ic z
746 The
747 .Nm
748 utility presents message headers in windowfuls as described under the
749 .Ic headers
750 command.
751 You can move
752 .Nm Ns 's
753 attention forward to the next window with the
754 .Ic z
755 command.
756 Also, you can move to the previous window by using
757 .Ic z\- .
758 .El
759 .Ss Tilde/Escapes
760 Here is a summary of the tilde escapes,
761 which are used when composing messages to perform
762 special functions.
763 Tilde escapes are only recognized at the beginning
764 of lines.
765 The name
766 .Dq "tilde escape"
767 is somewhat of a misnomer since the actual escape character can be set
768 by the option
769 .Va escape .
770 .Bl -tag -width indent
771 .It Ic ~a
772 Inserts the autograph string from the sign= option into the message.
773 .It Ic ~A
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
778 .Dq ( blind
779 carbon copy).
780 .It Ic ~c Ar name ...
781 Add the given names to the list of carbon copy recipients.
782 .It Ic ~d
783 Read the file
784 .Pa dead.letter
785 from your home directory into the message.
786 .It Ic ~e
787 Invoke the text editor on the message collected so far.
788 After the
789 editing session is finished, you may continue appending text to the
790 message.
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
795 .Ic ignore
796 or
797 .Ic retain
798 command) are not included.
799 .It Ic ~F Ar messages
800 Identical to
801 .Ic ~f ,
802 except all message headers are included.
803 .It Ic ~h
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.
807 .It Ic ~i Ar string
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
812 .Va indentprefix .
813 If no messages are specified,
814 read the current message.
815 Message headers currently being ignored (by the
816 .Ic ignore
817 or
818 .Ic retain
819 command) are not included.
820 .It Ic ~M Ar messages
821 Identical to
822 .Ic ~m ,
823 except all message headers are included.
824 .It Ic ~p
825 Print out the message collected so far, prefaced by the message header
826 fields.
827 .It Ic ~q
828 Abort the message being sent, copying the message to
829 .Pa dead.letter
830 in your home directory if
831 .Va save
832 is set.
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
837 .Ql \&! ,
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.
840 .It Ic ~R Ar string
841 Use
842 .Ar string
843 as the Reply-To field.
844 .It Ic ~s Ar string
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.
848 .It Ic ~v
849 Invoke an alternative editor (defined by the
850 .Ev VISUAL
851 environment variable) on the
852 message collected so far.
853 Usually, the alternative editor will be a
854 screen editor.
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.
859 .It Ic ~x
860 Exits as with
861 .Ic ~q ,
862 except the message is not saved in
863 .Pa dead.letter .
864 .It Ic ~! Ar command
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.
868 If the command gives
869 no output or terminates abnormally, retain the original text of the
870 message.
871 The command
872 .Xr fmt 1
873 is often used as
874 .Ar command
875 to rejustify the message.
876 .It Ic ~: Ar mail-command , Ic ~_ Ar mail-command
877 Execute the given
878 .Nm
879 command.
880 Not all commands, however, are allowed.
881 .It Ic ~.
882 Simulate end-of-file on input.
883 .It Ic ~?
884 Print a summary of the available command escapes.
885 .It Ic ~~ Ar string
886 Insert the string of text in the message prefaced by a single
887 .Ql ~ .
888 If
889 you have changed the escape character, then you should double
890 that character in order to send it.
891 .El
892 .Ss "Mail Options"
893 Options can be set with the
894 .Ic set
895 command
896 and can be disabled with the
897 .Ic unset
898 or
899 .Ic set Cm no Ns Ar name
900 commands.
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,
905 .Nm
906 will look for an environment variable of the same name.
907 The available options include the following:
908 .Bl -tag -width indent
909 .It Va append
910 Causes messages saved in
911 .Pa mbox
912 to be appended to the end rather than prepended.
913 This should always be set (preferably in one of the system-wide
914 .Pa mail.rc
915 files).
916 Default is
917 .Va noappend .
918 .It Va ask , asksub
919 Causes
920 .Nm
921 to prompt you for the subject of each message you send.
922 If
923 you respond with simply a newline, no subject field will be sent.
924 Default is
925 .Va asksub .
926 .It Va askbcc
927 Causes you to be prompted for additional blind carbon copy recipients at the
928 end of each message.
929 Responding with a newline indicates your
930 satisfaction with the current list.
931 Default is
932 .Va noaskbcc .
933 .It Va askcc
934 Causes you to be prompted for additional carbon copy recipients at the
935 end of each message.
936 Responding with a newline indicates your
937 satisfaction with the current list.
938 Default is
939 .Va noaskcc .
940 .It Va autoinc
941 Causes new mail to be automatically incorporated when it arrives.
942 Setting this is similar to issuing the
943 .Ic inc
944 command at each prompt, except that the current message is not
945 reset when new mail arrives.
946 Default is
947 .Va noautoinc .
948 .It Va autoprint
949 Causes the
950 .Ic delete
951 command to behave like
952 .Ic dp ;
953 thus, after deleting a message, the next one will be typed
954 automatically.
955 Default is
956 .Va noautoprint .
957 .It Va crt
958 The valued option
959 .Va crt
960 is used as a threshold to determine how long a message must
961 be before
962 .Ev PAGER
963 is used to read it.
964 If
965 .Va crt
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
969 .Xr stty 1 ) .
970 Default is
971 .Va nocrt .
972 .It Va debug
973 Setting the binary option
974 .Va debug
975 is the same as specifying
976 .Fl d
977 on the command line and causes
978 .Nm
979 to output all sorts of information useful for debugging
980 .Nm .
981 In case
982 .Nm
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.
986 Default is
987 .Va nodebug .
988 .It Va dot
989 The binary option
990 .Va dot
991 causes
992 .Nm
993 to interpret a period alone on a line as the terminator
994 of a message you are sending.
995 Default is
996 .Va nodot .
997 .It Va escape
998 If defined, the first character of this option gives the character to
999 use in place of
1000 .Ql ~
1001 to denote escapes.
1002 .It Va flipr
1003 Reverses the sense of
1004 .Ic reply
1005 and
1006 .Ic Reply
1007 commands.
1008 Default is
1009 .Va noflipr .
1010 .It Va folder
1011 The name of the directory to use for storing folders of
1012 messages.
1013 If this name begins with a
1014 .Ql / ,
1015 .Nm
1016 considers it to be an absolute pathname; otherwise, the
1017 folder directory is found relative to your home directory.
1018 .It Va header
1019 If defined, initially display message headers when reading mail or
1020 editing a mail folder.
1021 Default is
1022 .Va header .
1023 This option can be disabled by giving the
1024 .Fl N
1025 flag on the command line.
1026 .It Va hold
1027 This option is used to hold messages in the system mailbox
1028 by default.
1029 Default is
1030 .Va nohold .
1031 .It Va ignore
1032 Causes interrupt signals from your terminal to be ignored and echoed as
1033 .Li @ Ns 's.
1034 Default is
1035 .Va noignore .
1036 .It Va ignoreeof
1037 An option related to
1038 .Va dot
1039 is
1040 .Va ignoreeof
1041 which makes
1042 .Nm
1043 refuse to accept a
1044 .Aq Li control-D
1045 as the end of a message.
1046 .Ar Ignoreeof
1047 also applies to
1048 .Nm
1049 command mode.
1050 Default is
1051 .Va noignoreeof .
1052 .It Va indentprefix
1053 String used by the
1054 .Ic ~m
1055 tilde escape for indenting messages, in place of
1056 the normal tab character
1057 .Pq Li ^I .
1058 Be sure to quote the value if it contains
1059 spaces or tabs.
1060 .It Va metoo
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.
1065 Default is
1066 .Va nometoo .
1067 .It Va quiet
1068 Suppresses the printing of the version when first invoked.
1069 Default is
1070 .Va noquiet .
1071 .It Va record
1072 If defined, gives the pathname of the file used to record all outgoing
1073 mail.
1074 If not defined, outgoing mail is not saved.
1075 Default is
1076 .Va norecord .
1077 .It Va Replyall
1078 Reverses the sense of
1079 .Ic reply
1080 and
1081 .Ic Reply
1082 commands.
1083 Default is
1084 .Va noReplyall .
1085 .It Va save
1086 If this option is set, and you abort a message with two
1087 .Tn RUBOUT
1088 (erase or delete),
1089 .Nm
1090 will copy the partial letter to the file
1091 .Pa dead.letter
1092 in your home directory.
1093 Default is
1094 .Va save .
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
1099 .Ar y
1100 in the header field
1101 .Ar x .
1102 The string search is case insensitive.
1103 If
1104 .Ar x
1105 is omitted, it will default to the
1106 .Dq Li Subject
1107 header field.
1108 The form
1109 .Dq Li /to: Ns Ar y
1110 is a special case, and will expand
1111 to all messages containing the substring
1112 .Ar y
1113 in the
1114 .Dq Li To ,
1115 .Dq Li Cc
1116 or
1117 .Dq Li Bcc
1118 header fields.
1119 The check for
1120 .Qq Li "to"
1121 is case sensitive, so that
1122 .Dq Li /To: Ns Ar y
1123 can be used to limit the search for
1124 .Ar y
1125 to just the
1126 .Dq Li To:
1127 field.
1128 Default is
1129 .Va nosearchheaders .
1130 .It Va toplines
1131 If defined, gives the number of lines of a message to be printed out
1132 with the
1133 .Ic top
1134 command; normally, the first five lines are printed.
1135 .It Va verbose
1136 Setting the option
1137 .Va verbose
1138 is the same as using the
1139 .Fl v
1140 flag on the command line.
1141 When
1142 .Nm
1143 runs in verbose mode,
1144 the actual delivery of messages is displayed on the user's
1145 terminal.
1146 Default is
1147 .Va noverbose .
1148 .El
1149 .Sh ENVIRONMENT
1150 .Bl -tag -width ".Ev REPLYTO"
1151 .It Ev DEAD
1152 Pathname of the file to save partial messages to in case of interrupts
1153 or delivery errors.
1154 Default is
1155 .Pa ~/dead.letter .
1156 .It Ev EDITOR
1157 Pathname of the text editor to use in the
1158 .Ic edit
1159 command and
1160 .Ic ~e
1161 escape.
1162 If not defined, then a default editor is used.
1163 .It Ev HOME
1164 Pathname of the user's home directory.
1165 .It Ev LISTER
1166 Pathname of the directory lister to use in the
1167 .Ic folders
1168 command.
1169 Default is
1170 .Pa /bin/ls .
1171 .It Ev MAIL
1172 Location of the user's mailbox.
1173 Default is
1174 .Pa /var/mail .
1175 .It Ev MAILRC
1176 Pathname of file containing initial
1177 .Nm
1178 commands.
1179 Default is
1180 .Pa ~/.mailrc .
1181 .It Ev MBOX
1182 The name of the mailbox file.
1183 It can be the name of a folder.
1184 The default is
1185 .Pa mbox
1186 in the user's home directory.
1187 .It Ev PAGER
1188 Pathname of the program to use in the
1189 .Ic more
1190 command or when
1191 .Va crt
1192 variable is set.
1193 The default paginator
1194 .Xr more 1
1195 is used if this option is not defined.
1196 .It Ev REPLYTO
1197 If set, will be used to initialize the Reply-To field for outgoing
1198 messages.
1199 .It Ev SHELL
1200 Pathname of the shell to use in the
1201 .Ic \&!
1202 command and the
1203 .Ic ~!
1204 escape.
1205 A default shell is used if this option is
1206 not defined.
1207 .It Ev TMPDIR
1208 Pathname of the directory used for creating temporary files.
1209 .It Ev VISUAL
1210 Pathname of the text editor to use in the
1211 .Ic visual
1212 command and
1213 .Ic ~v
1214 escape.
1215 .It Ev USER
1216 Login name of the user executing mail.
1217 .El
1218 .Sh FILES
1219 .Bl -tag -width ".Pa /usr/share/misc/mail.*help" -compact
1220 .It Pa /var/mail/*
1221 Post office.
1222 .It Pa ~/mbox
1223 User's old mail.
1224 .It Pa ~/.mailrc
1225 File giving initial
1226 .Nm
1227 commands.
1228 This can be overridden by setting the
1229 .Ev MAILRC
1230 environment variable.
1231 .It Pa /tmp/R*
1232 Temporary files.
1233 .It Pa /usr/share/misc/mail.*help
1234 Help files.
1235 .Pp
1236 .It Pa /usr/share/misc/mail.rc
1237 .It Pa /usr/local/etc/mail.rc
1238 .It Pa /etc/mail.rc
1239 System-wide initialization files.
1240 Each file will be sourced, in order,
1241 if it exists.
1242 .El
1243 .Sh SEE ALSO
1244 .Xr fmt 1 ,
1245 .Xr newaliases 1 ,
1246 .Xr vacation 1 ,
1247 .Xr aliases 5 ,
1248 .Xr mailaddr 7 ,
1249 .Xr sendmail 8
1250 .Rs
1251 .%T "The Mail Reference Manual"
1252 .Re
1253 .Sh HISTORY
1254 A
1255 .Nm
1256 command
1257 appeared in
1258 .At v1 .
1259 This man page is derived from
1260 .%T "The Mail Reference Manual"
1261 originally written by
1262 .An Kurt Shoens .
1263 .Sh BUGS
1264 There are some flags that are not documented here.
1265 Most are
1266 not useful to the general user.
1267 .Pp
1268 Usually,
1269 .Nm
1270 is just a link to
1271 .Nm Mail
1272 and
1273 .Nm mailx ,
1274 which can be confusing.
1275 .Pp
1276 The name of the
1277 .Ic alternates
1278 list is incorrect English (it should be
1279 .Dq alternatives ) ,
1280 but is retained for compatibility.