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