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