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