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