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