xref: /freebsd/usr.bin/mail/mail.1 (revision d37ea99837e6ad50837fd9fe1771ddf1c3ba6002)
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 February 29, 2004
36.Dt MAIL 1
37.Os
38.Sh NAME
39.Nm mail ,
40.Nm Mail ,
41.Nm mailx
42.Nd send and receive mail
43.Sh SYNOPSIS
44.Nm
45.Op Fl EiInv
46.Op Fl s Ar subject
47.Op Fl c Ar cc-addr
48.Op Fl b Ar bcc-addr
49.Op Fl F
50.Ar to-addr ...
51.Op Fl Ar sendmail-option ...
52.Nm
53.Op Fl EHiInNv
54.Op Fl F
55.Fl f
56.Op Ar name
57.Nm
58.Op Fl EHiInNv
59.Op Fl F
60.Op Fl u Ar user
61.Nm
62.Fl e
63.Op Fl f Ar name
64.Nm
65.Op Fl H
66.Sh INTRODUCTION
67The
68.Nm
69utility is an intelligent mail processing system, which has
70a command syntax reminiscent of
71.Xr ed 1
72with lines replaced by messages.
73.Pp
74The following options are available:
75.Bl -tag -width indent
76.It Fl v
77Verbose mode.
78The details of
79delivery are displayed on the user's terminal.
80.It Fl e
81Test for the presence of mail in the (by default, system)
82mailbox.
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.
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
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)"
330See
331.Xr mailaddr 7
332for a description of network addresses.
333.Pp
334The
335.Nm
336utility has a number of options which can be set in the
337.Pa .mailrc
338file to alter its behavior; thus
339.Dq Li "set askcc"
340enables the
341.Va askcc
342feature.
343(These options are summarized below.)
344.Sh SUMMARY
345(Adapted from the
346.%T "Mail Reference Manual" . )
347.Pp
348Each command is typed on a line by itself, and may take arguments
349following the command word.
350The command need not be typed in its
351entirety \(em the first command which matches the typed prefix is used.
352For commands which take message lists as arguments, if no message
353list is given, then the next message forward which satisfies the
354command's requirements is used.
355If there are no messages forward of
356the current message, the search proceeds backwards, and if there are no
357good messages at all,
358.Nm
359types
360.Dq Li "No applicable messages"
361and
362aborts the command.
363.Bl -tag -width indent
364.It Ic \-
365Print out the preceding message.
366If given a numeric
367argument
368.Ar n ,
369goes to the
370.Ar n Ns 'th
371previous message and prints it.
372.It Ic #
373ignore the remainder of the line as a comment.
374.It Ic \&?
375Prints a brief summary of commands.
376.It Ic \&!
377Executes the shell
378(see
379.Xr sh 1
380and
381.Xr csh 1 )
382command which follows.
383.It Ic Print
384.Pq Ic P
385Like
386.Ic print
387but also prints out ignored header fields.
388See also
389.Ic print , ignore
390and
391.Ic retain .
392.It Ic Reply
393.Pq Ic R
394Reply to originator.
395Does not reply to other
396recipients of the original message.
397.It Ic Type
398.Pq Ic T
399Identical to the
400.Ic Print
401command.
402.It Ic alias
403.Pq Ic a
404With no arguments, prints out all currently-defined aliases.
405With one
406argument, prints out that alias.
407With more than one argument, creates
408a new alias or changes an old one.
409.It Ic alternates
410.Pq Ic alt
411The
412.Ic alternates
413command is useful if you have accounts on several machines.
414It can be used to inform
415.Nm
416that the listed addresses are really you.
417When you
418.Ic reply
419to messages,
420.Nm
421will not send a copy of the message to any of the addresses
422listed on the
423.Ic alternates
424list.
425If the
426.Ic alternates
427command is given with no argument, the current set of alternative
428names is displayed.
429.It Ic chdir
430.Pq Ic c
431Changes the user's working directory to that specified, if given.
432If
433no directory is given, then changes to the user's login directory.
434.It Ic copy
435.Pq Ic co
436The
437.Ic copy
438command does the same thing that
439.Ic save
440does, except that it does not mark the messages it
441is used on for deletion when you
442.Ic quit .
443.It Ic delete
444.Pq Ic d
445Takes a list of messages as argument and marks them all as deleted.
446Deleted messages will not be saved in
447.Pa mbox ,
448nor will they be available for most other commands.
449.It Ic dp
450(also
451.Ic dt )
452Deletes the current message and prints the next message.
453If there is no next message,
454.Nm
455says
456.Dq Li "at EOF" .
457.It Ic edit
458.Pq Ic e
459Takes a list of messages and points the text editor at each one in
460turn.
461On return from the editor, the message is read back in.
462.It Ic exit
463.Ic ( ex
464or
465.Ic x )
466Effects an immediate return to the shell without
467modifying the user's system mailbox, his
468.Pa mbox
469file, or his edit file in
470.Fl f .
471.It Ic file
472.Pq Ic fi
473The same as
474.Ic folder .
475.It Ic folders
476List the names of the folders in your folder directory.
477.It Ic folder
478.Pq Ic fo
479The
480.Ic folder
481command switches to a new mail file or folder.
482With no
483arguments, it tells you which file you are currently reading.
484If you give it an argument, it will write out changes (such
485as deletions) you have made in the current file and read in
486the new file.
487Some special conventions are recognized for
488the name.
489.Ql #
490means the previous file,
491.Ql %
492means your system mailbox,
493.Dq Li % Ns Ar user
494means user's system mailbox,
495.Ql &
496means your
497.Pa mbox
498file, and
499.Dq Li + Ns Ar folder
500means a file in your folder
501directory.
502.It Ic from
503.Pq Ic f
504Takes a list of messages and prints their message headers.
505.It Ic headers
506.Pq Ic h
507Lists the current range of headers, which is an 18-message group.
508If
509a
510.Ql +
511argument is given, then the next 18-message group is printed, and if
512a
513.Ql \-
514argument is given, the previous 18-message group is printed.
515.It Ic help
516A synonym for
517.Ic \&? .
518.It Ic hold
519.Ic ( ho ,
520also
521.Ic preserve )
522Takes a message list and marks each
523message therein to be saved in the
524user's system mailbox instead of in
525.Pa mbox .
526Does not override the
527.Ic delete
528command.
529.It Ic ignore
530Add the list of header fields named to the
531.Ar ignored list .
532Header fields in the ignore list are not printed
533on your terminal when you print a message.
534This
535command is very handy for suppression of certain machine-generated
536header fields.
537The
538.Ic Type
539and
540.Ic Print
541commands can be used to print a message in its entirety, including
542ignored fields.
543If
544.Ic ignore
545is executed with no arguments, it lists the current set of
546ignored fields.
547.It Ic inc
548Incorporate any new messages that have arrived while mail
549is being read.
550The new messages are added to the end of the message list,
551and the current message is reset to be the first new mail message.
552This does not renumber the existing message list, nor
553does it cause any changes made so far to be saved.
554.It Ic mail
555.Pq Ic m
556Takes as argument login names and distribution group names and sends
557mail to those people.
558.It Ic mbox
559Indicate that a list of messages be sent to
560.Pa mbox
561in your home directory when you quit.
562This is the default
563action for messages if you do
564.Em not
565have the
566.Ic hold
567option set.
568.It Ic more
569.Pq Ic mo
570Takes a list of messages and invokes the pager on that list.
571.It Ic next
572.Ic ( n ,
573like
574.Ic +
575or
576.Tn CR )
577Goes to the next message in sequence and types it.
578With an argument list, types the next matching message.
579.It Ic preserve
580.Pq Ic pre
581A synonym for
582.Ic hold .
583.It Ic print
584.Pq Ic p
585Takes a message list and types out each message on the user's terminal.
586.It Ic quit
587.Pq Ic q
588Terminates the session, saving all undeleted, unsaved messages in
589the user's
590.Pa mbox
591file in his login directory, preserving all messages marked with
592.Ic hold
593or
594.Ic preserve
595or never referenced
596in his system mailbox, and removing all other messages from his system
597mailbox.
598If new mail has arrived during the session, the message
599.Dq Li "You have new mail"
600is given.
601If given while editing a
602mailbox file with the
603.Fl f
604flag, then the edit file is rewritten.
605A return to the shell is
606effected, unless the rewrite of edit file fails, in which case the user
607can escape with the
608.Ic exit
609command.
610.It Ic reply
611.Pq Ic r
612Takes a message list and sends mail to the sender and all
613recipients of the specified message.
614The default message must not be deleted.
615.It Ic respond
616A synonym for
617.Ic reply .
618.It Ic retain
619Add the list of header fields named to the
620.Em "retained list" .
621Only the header fields in the retained list
622are shown on your terminal when you print a message.
623All other header fields are suppressed.
624The
625.Ic type
626and
627.Ic print
628commands can be used to print a message in its entirety.
629If
630.Ic retain
631is executed with no arguments, it lists the current set of
632retained fields.
633.It Ic save
634.Pq Ic s
635Takes a message list and a filename and appends each message in
636turn to the end of the file.
637The filename in quotes, followed by the line
638count and character count is echoed on the user's terminal.
639.It Ic set
640.Pq Ic se
641With no arguments, prints all variable values.
642Otherwise, sets
643option.
644Arguments are of the form
645.Ar option Ns Li = Ns Ar value
646(no space before or after
647.Ql = )
648or
649.Ar option .
650Quotation marks may be placed around any part of the assignment statement to
651quote blanks or tabs, i.e.\&
652.Dq Li "set indentprefix=\*q->\*q"
653.It Ic saveignore
654.Ic Saveignore
655is to
656.Ic save
657what
658.Ic ignore
659is to
660.Ic print
661and
662.Ic type .
663Header fields thus marked are filtered out when
664saving a message by
665.Ic save
666or when automatically saving to
667.Pa mbox .
668.It Ic saveretain
669.Ic Saveretain
670is to
671.Ic save
672what
673.Ic retain
674is to
675.Ic print
676and
677.Ic type .
678Header fields thus marked are the only ones saved
679with a message when saving by
680.Ic save
681or when automatically saving to
682.Pa mbox .
683.Ic Saveretain
684overrides
685.Ic saveignore .
686.It Ic shell
687.Pq Ic sh
688Invokes an interactive version of the shell.
689.It Ic size
690Takes a message list and prints out the size in characters of each
691message.
692.It Ic source
693The
694.Ic source
695command reads
696commands from a file.
697.It Ic top
698Takes a message list and prints the top few lines of each.
699The number of
700lines printed is controlled by the variable
701.Va toplines
702and defaults to 5.
703.It Ic type
704.Pq Ic t
705A synonym for
706.Ic print .
707.It Ic unalias
708Takes a list of names defined by
709.Ic alias
710commands and discards the remembered groups of users.
711The group names
712no longer have any significance.
713.It Ic undelete
714.Pq Ic u
715Takes a message list and marks each message as
716.Em not
717being deleted.
718.It Ic unread
719.Pq Ic U
720Takes a message list and marks each message as
721.Em not
722having been read.
723.It Ic unset
724Takes a list of option names and discards their remembered values;
725the inverse of
726.Ic set .
727.It Ic visual
728.Pq Ic v
729Takes a message list and invokes the display editor on each message.
730.It Ic write
731.Pq Ic w
732Similar to
733.Ic save ,
734except that
735.Em only
736the message body
737.Em ( without
738the header) is saved.
739Extremely useful for such tasks as sending and receiving source
740program text over the message system.
741.It Ic xit
742.Pq Ic x
743A synonym for
744.Ic exit .
745.It Ic z
746The
747.Nm
748utility presents message headers in windowfuls as described under the
749.Ic headers
750command.
751You can move
752.Nm Ns 's
753attention forward to the next window with the
754.Ic z
755command.
756Also, you can move to the previous window by using
757.Ic z\- .
758.El
759.Ss Tilde/Escapes
760Here is a summary of the tilde escapes,
761which are used when composing messages to perform
762special functions.
763Tilde escapes are only recognized at the beginning
764of lines.
765The name
766.Dq "tilde escape"
767is somewhat of a misnomer since the actual escape character can be set
768by the option
769.Va escape .
770.Bl -tag -width indent
771.It Ic ~a
772Inserts the autograph string from the sign= option into the message.
773.It Ic ~A
774Inserts the autograph string from the Sign= option into the message.
775.It Ic ~b Ar name ...
776Add the given names to the list of carbon copy recipients but do not make
777the names visible in the Cc: line
778.Dq ( blind
779carbon copy).
780.It Ic ~c Ar name ...
781Add the given names to the list of carbon copy recipients.
782.It Ic ~d
783Read the file
784.Pa dead.letter
785from your home directory into the message.
786.It Ic ~e
787Invoke the text editor on the message collected so far.
788After the
789editing session is finished, you may continue appending text to the
790message.
791.It Ic ~f Ar messages
792Read the named messages into the message being sent.
793If no messages are specified, read in the current message.
794Message headers currently being ignored (by the
795.Ic ignore
796or
797.Ic retain
798command) are not included.
799.It Ic ~F Ar messages
800Identical to
801.Ic ~f ,
802except all message headers are included.
803.It Ic ~h
804Edit the message header fields by typing each one in turn and allowing
805the user to append text to the end or modify the field by using the
806current terminal erase and kill characters.
807.It Ic ~i Ar string
808Inserts the value of the named option into the text of the message.
809.It Ic ~m Ar messages
810Read the named messages into the message being sent, indented by a
811tab or by the value of
812.Va indentprefix .
813If no messages are specified,
814read the current message.
815Message headers currently being ignored (by the
816.Ic ignore
817or
818.Ic retain
819command) are not included.
820.It Ic ~M Ar messages
821Identical to
822.Ic ~m ,
823except all message headers are included.
824.It Ic ~p
825Print out the message collected so far, prefaced by the message header
826fields.
827.It Ic ~q
828Abort the message being sent, copying the message to
829.Pa dead.letter
830in your home directory if
831.Va save
832is set.
833.It Ic ~r Ar filename , Ic ~r Li \&! Ns Ar command
834.It Ic ~< Ar filename , Ic ~< Li \&! Ns Ar command
835Read the named file into the message.
836If the argument begins with a
837.Ql \&! ,
838the rest of the string is taken as an arbitrary system command and is
839executed, with the standard output inserted into the message.
840.It Ic ~R Ar string
841Use
842.Ar string
843as the Reply-To field.
844.It Ic ~s Ar string
845Cause the named string to become the current subject field.
846.It Ic ~t Ar name ...
847Add the given names to the direct recipient list.
848.It Ic ~v
849Invoke an alternative editor (defined by the
850.Ev VISUAL
851environment variable) on the
852message collected so far.
853Usually, the alternative editor will be a
854screen editor.
855After you quit the editor, you may resume appending
856text to the end of your message.
857.It Ic ~w Ar filename
858Write the message onto the named file.
859.It Ic ~x
860Exits as with
861.Ic ~q ,
862except the message is not saved in
863.Pa dead.letter .
864.It Ic ~! Ar command
865Execute the indicated shell command, then return to the message.
866.It Ic ~| Ar command , Ic ~^ Ar command
867Pipe the message through the command as a filter.
868If the command gives
869no output or terminates abnormally, retain the original text of the
870message.
871The command
872.Xr fmt 1
873is often used as
874.Ar command
875to rejustify the message.
876.It Ic ~: Ar mail-command , Ic ~_ Ar mail-command
877Execute the given
878.Nm
879command.
880Not all commands, however, are allowed.
881.It Ic ~.
882Simulate end-of-file on input.
883.It Ic ~?
884Print a summary of the available command escapes.
885.It Ic ~~ Ar string
886Insert the string of text in the message prefaced by a single
887.Ql ~ .
888If
889you have changed the escape character, then you should double
890that character in order to send it.
891.El
892.Ss "Mail Options"
893Options can be set with the
894.Ic set
895command
896and can be disabled with the
897.Ic unset
898or
899.Ic set Cm no Ns Ar name
900commands.
901Options may be either binary, in which case it is only
902significant to see whether they are set or not; or string, in which
903case the actual value is of interest.
904If an option is not set,
905.Nm
906will look for an environment variable of the same name.
907The available options include the following:
908.Bl -tag -width indent
909.It Va append
910Causes messages saved in
911.Pa mbox
912to be appended to the end rather than prepended.
913This should always be set (preferably in one of the system-wide
914.Pa mail.rc
915files).
916Default is
917.Va noappend .
918.It Va ask , asksub
919Causes
920.Nm
921to prompt you for the subject of each message you send.
922If
923you respond with simply a newline, no subject field will be sent.
924Default is
925.Va asksub .
926.It Va askbcc
927Causes you to be prompted for additional blind carbon copy recipients at the
928end of each message.
929Responding with a newline indicates your
930satisfaction with the current list.
931Default is
932.Va noaskbcc .
933.It Va askcc
934Causes you to be prompted for additional carbon copy recipients at the
935end of each message.
936Responding with a newline indicates your
937satisfaction with the current list.
938Default is
939.Va noaskcc .
940.It Va autoinc
941Causes new mail to be automatically incorporated when it arrives.
942Setting this is similar to issuing the
943.Ic inc
944command at each prompt, except that the current message is not
945reset when new mail arrives.
946Default is
947.Va noautoinc .
948.It Va autoprint
949Causes the
950.Ic delete
951command to behave like
952.Ic dp ;
953thus, after deleting a message, the next one will be typed
954automatically.
955Default is
956.Va noautoprint .
957.It Va crt
958The valued option
959.Va crt
960is used as a threshold to determine how long a message must
961be before
962.Ev PAGER
963is used to read it.
964If
965.Va crt
966is set without a value,
967then the height of the terminal screen stored in the system
968is used to compute the threshold (see
969.Xr stty 1 ) .
970Default is
971.Va nocrt .
972.It Va debug
973Setting the binary option
974.Va debug
975is the same as specifying
976.Fl d
977on the command line and causes
978.Nm
979to output all sorts of information useful for debugging
980.Nm .
981Default is
982.Va nodebug .
983.It Va dot
984The binary option
985.Va dot
986causes
987.Nm
988to interpret a period alone on a line as the terminator
989of a message you are sending.
990Default is
991.Va nodot .
992.It Va escape
993If defined, the first character of this option gives the character to
994use in place of
995.Ql ~
996to denote escapes.
997.It Va flipr
998Reverses the sense of
999.Ic reply
1000and
1001.Ic Reply
1002commands.
1003Default is
1004.Va noflipr .
1005.It Va folder
1006The name of the directory to use for storing folders of
1007messages.
1008If this name begins with a
1009.Ql / ,
1010.Nm
1011considers it to be an absolute pathname; otherwise, the
1012folder directory is found relative to your home directory.
1013.It Va header
1014If defined, initially display message headers when reading mail or
1015editing a mail folder.
1016Default is
1017.Va header .
1018This option can be disabled by giving the
1019.Fl N
1020flag on the command line.
1021.It Va hold
1022This option is used to hold messages in the system mailbox
1023by default.
1024Default is
1025.Va nohold .
1026.It Va ignore
1027Causes interrupt signals from your terminal to be ignored and echoed as
1028.Li @ Ns 's.
1029Default is
1030.Va noignore .
1031.It Va ignoreeof
1032An option related to
1033.Va dot
1034is
1035.Va ignoreeof
1036which makes
1037.Nm
1038refuse to accept a
1039.Aq Li control-D
1040as the end of a message.
1041.Ar Ignoreeof
1042also applies to
1043.Nm
1044command mode.
1045Default is
1046.Va noignoreeof .
1047.It Va indentprefix
1048String used by the
1049.Ic ~m
1050tilde escape for indenting messages, in place of
1051the normal tab character
1052.Pq Li ^I .
1053Be sure to quote the value if it contains
1054spaces or tabs.
1055.It Va metoo
1056Usually, when a group is expanded that contains the sender, the sender
1057is removed from the expansion.
1058Setting this option causes the sender
1059to be included in the group.
1060Default is
1061.Va nometoo .
1062.It Va quiet
1063Suppresses the printing of the version when first invoked.
1064Default is
1065.Va noquiet .
1066.It Va record
1067If defined, gives the pathname of the file used to record all outgoing
1068mail.
1069If not defined, outgoing mail is not saved.
1070Default is
1071.Va norecord .
1072.It Va Replyall
1073Reverses the sense of
1074.Ic reply
1075and
1076.Ic Reply
1077commands.
1078Default is
1079.Va noReplyall .
1080.It Va save
1081If this option is set, and you abort a message with two
1082.Tn RUBOUT
1083(erase or delete),
1084.Nm
1085will copy the partial letter to the file
1086.Pa dead.letter
1087in your home directory.
1088Default is
1089.Va save .
1090.It Va searchheaders
1091If this option is set, then a message-list specifier in the form
1092.Dq Li / Ns Ar x Ns Li : Ns Ar y
1093will expand to all messages containing the substring
1094.Ar y
1095in the header field
1096.Ar x .
1097The string search is case insensitive.
1098If
1099.Ar x
1100is ommitted, it will default to the
1101.Dq Li Subject
1102header field.
1103The form
1104.Dq Li /to: Ns Ar y
1105is a special case, and will expand
1106to all messages containing the substring
1107.Ar y
1108in the
1109.Dq Li To ,
1110.Dq Li Cc
1111or
1112.Dq Li Bcc
1113header fields.
1114The check for
1115.Qq Li "to"
1116is case sensitive, so that
1117.Dq Li /To: Ns Ar y
1118can be used to limit the search for
1119.Ar y
1120to just the
1121.Dq Li To:
1122field.
1123Default is
1124.Va nosearchheaders .
1125.It Va toplines
1126If defined, gives the number of lines of a message to be printed out
1127with the
1128.Ic top
1129command; normally, the first five lines are printed.
1130.It Va verbose
1131Setting the option
1132.Va verbose
1133is the same as using the
1134.Fl v
1135flag on the command line.
1136When
1137.Nm
1138runs in verbose mode,
1139the actual delivery of messages is displayed on the user's
1140terminal.
1141Default is
1142.Va noverbose .
1143.El
1144.Sh ENVIRONMENT
1145.Bl -tag -width ".Ev REPLYTO"
1146.It Ev DEAD
1147Pathname of the file to save partial messages to in case of interrupts
1148or delivery errors.
1149Default is
1150.Pa ~/dead.letter .
1151.It Ev EDITOR
1152Pathname of the text editor to use in the
1153.Ic edit
1154command and
1155.Ic ~e
1156escape.
1157If not defined, then a default editor is used.
1158.It Ev HOME
1159Pathname of the user's home directory.
1160.It Ev LISTER
1161Pathname of the directory lister to use in the
1162.Ic folders
1163command.
1164Default is
1165.Pa /bin/ls .
1166.It Ev MAIL
1167Location of the user's mailbox.
1168Default is
1169.Pa /var/mail .
1170.It Ev MAILRC
1171Pathname of file containing initial
1172.Nm
1173commands.
1174Default is
1175.Pa ~/.mailrc .
1176.It Ev MBOX
1177The name of the mailbox file.
1178It can be the name of a folder.
1179The default is
1180.Pa mbox
1181in the user's home directory.
1182.It Ev PAGER
1183Pathname of the program to use in the
1184.Ic more
1185command or when
1186.Va crt
1187variable is set.
1188The default paginator
1189.Xr more 1
1190is used if this option is not defined.
1191.It Ev REPLYTO
1192If set, will be used to initialize the Reply-To field for outgoing
1193messages.
1194.It Ev SHELL
1195Pathname of the shell to use in the
1196.Ic \&!
1197command and the
1198.Ic ~!
1199escape.
1200A default shell is used if this option is
1201not defined.
1202.It Ev VISUAL
1203Pathname of the text editor to use in the
1204.Ic visual
1205command and
1206.Ic ~v
1207escape.
1208.It Ev USER
1209Login name of the user executing mail.
1210.El
1211.Sh FILES
1212.Bl -tag -width ".Pa /usr/share/misc/mail.*help" -compact
1213.It Pa /var/mail/*
1214Post office.
1215.It Pa ~/mbox
1216User's old mail.
1217.It Pa ~/.mailrc
1218File giving initial
1219.Nm
1220commands.
1221This can be overridden by setting the
1222.Ev MAILRC
1223environment variable.
1224.It Pa /tmp/R*
1225Temporary files.
1226.It Pa /usr/share/misc/mail.*help
1227Help files.
1228.Pp
1229.It Pa /usr/share/misc/mail.rc
1230.It Pa /usr/local/etc/mail.rc
1231.It Pa /etc/mail.rc
1232System-wide initialization files.
1233Each file will be sourced, in order,
1234if it exists.
1235.El
1236.Sh SEE ALSO
1237.Xr fmt 1 ,
1238.Xr newaliases 1 ,
1239.Xr vacation 1 ,
1240.Xr aliases 5 ,
1241.Xr mailaddr 7 ,
1242.Xr sendmail 8
1243.Rs
1244.%T "The Mail Reference Manual"
1245.Re
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