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