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