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