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