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