xref: /openbsd-src/usr.bin/mail/mail.1 (revision 50b7afb2c2c0993b0894d4e34bf857cb13ed9c80)
1.\"	$OpenBSD: mail.1,v 1.65 2014/03/27 13:08:24 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: March 27 2014 $
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.
209.Pp
210Messages may also be selected using one of the following categories:
211.Pp
212.Bl -tag -width Ds -offset indent -compact
213.It *
214all messages
215.It $
216last message
217.It :d
218deleted messages
219.It :n
220new messages
221.It :o
222old messages
223.It :r
224read messages
225.It :u
226unread messages
227.El
228.Pp
229Thus the command
230.Ic top ,
231which prints the first few lines of a message,
232could be used in
233.Ic top *
234to print the first few lines of all messages.
235.Ss Replying to or originating mail
236You can use the
237.Ic reply
238command to
239set up a response to a message, sending it back to the
240person who it was from.
241Text you then type in, up to an end-of-file,
242defines the contents of the message.
243While you are composing a message,
244.Nm mail
245treats lines beginning with the tilde
246.Pq Sq ~
247character specially.
248For instance, typing
249.Ic ~m
250(alone on a line) will place a copy
251of the current message into the response, right shifting it by a single
252tab-stop (see the
253.Va indentprefix
254variable, below).
255Other escapes will set up subject fields, add and delete recipients
256to the message, and allow you to escape to an editor to revise the
257message or to a shell to run some commands.
258(These options
259are given in the summary below.)
260.Ss Ending a mail processing session
261You can end a
262.Nm mail
263session with the
264.Ic quit
265.Pq Ic q
266command.
267Messages which have been examined go to your
268.Ar mbox
269file unless they have been deleted, in which case they are discarded.
270Unexamined messages go back to the post office (see the
271.Fl f
272option above).
273.Ss Personal and system wide distribution lists
274It is also possible to create personal distribution lists so that,
275for instance, you can send mail to
276.Dq Li cohorts
277and have it go
278to a group of people.
279Such lists can be defined by placing a line like
280.Pp
281.Dl alias cohorts bill ozalp jkf mark kridle@ucbcory
282.Pp
283in the file
284.Pa .mailrc
285in your home directory.
286The current list of such aliases can be displayed with the
287.Ic alias
288command in
289.Nm mail .
290System wide distribution lists can be created by editing
291.Pa /etc/mail/aliases
292(see
293.Xr aliases 5 ) ;
294these are kept in a different syntax.
295In mail you send, personal aliases will be expanded in mail sent
296to others so that they will be able to
297.Ic reply
298to the recipients.
299System wide aliases
300are not expanded when the mail is sent,
301but any reply returned to the machine will have the system wide
302alias expanded as all mail goes through an MTA.
303.Ss Network mail (ARPA, UUCP, Berknet)
304See
305.Xr mailaddr 7
306for a description of network addresses.
307.Pp
308.Nm mail
309has a number of options which can be set in the
310.Pa .mailrc
311file to alter its behavior; thus
312.Ic set askcc
313enables the
314.Ar askcc
315feature.
316(These options are summarized below.)
317.Sh SUMMARY
318(Adapted from the
319.Dq Mail Reference Manual . )
320.Pp
321Each command is typed on a line by itself, and may take arguments
322following the command word.
323The command need not be typed in its
324entirety -- the first command which matches the typed prefix is used.
325For commands which take message lists as arguments, if no message
326list is given, then the next message forward which satisfies the
327command's requirements is used.
328If there are no messages forward of
329the current message, the search proceeds backwards, and if there are no
330good messages at all,
331.Nm mail
332types
333.Dq \&No applicable messages
334and
335aborts the command.
336.Bl -tag -width delete
337.It Ic -
338Print out the preceding message.
339If given a numeric
340argument
341.Ar n ,
342goes to the
343.Ar n Ns th
344previous message and prints it.
345.It Ic \&?
346Prints a brief summary of commands.
347.It Ic \&!
348Executes the shell
349(see
350.Xr sh 1
351and
352.Xr csh 1 )
353command which follows.
354.It Ic alias
355.Pq Ic a
356With no arguments, prints out all currently defined aliases.
357With one
358argument, prints out that alias.
359With more than one argument, creates
360a new alias or changes an old one.
361.It Ic alternates
362.Pq Ic alt
363The
364.Ic alternates
365command is useful if you have accounts on several machines.
366It can be used to inform
367.Nm mail
368that the listed addresses are really you.
369When you
370.Ic reply
371to messages,
372.Nm mail
373will not send a copy of the message to any of the addresses
374listed on the
375.Ic alternates
376list.
377If the
378.Ic alternates
379command is given with no argument, the current set of alternate
380names is displayed.
381.It Ic chdir
382.Pq Ic c
383Changes the user's working directory to that specified, if given.
384If
385no directory is given, then changes to the user's login directory.
386.It Ic copy
387.Pq Ic co
388The
389.Ic copy
390command does the same thing that
391.Ic save
392does, except that it does not mark the messages it
393is used on for deletion when you quit.
394.It Ic delete
395.Pq Ic d
396Takes a list of messages as argument and marks them all as deleted.
397Deleted messages will not be saved in
398.Ar mbox ,
399nor will they be available for most other commands.
400.It Ic dp
401(also
402.Ic dt )
403Deletes the current message and prints the next message.
404If there is no next message,
405.Nm mail
406says
407.Dq Li "\&No more messages."
408.It Ic edit
409.Pq Ic e
410Takes a list of messages and points the text editor at each one in
411turn.
412On return from the editor, the message is read back in.
413.It Ic exit
414.Pf ( Ic ex
415or
416.Ic x )
417Effects an immediate return to the shell without
418modifying the user's system mailbox, his
419.Ar mbox
420file, or his edit file in
421.Fl f .
422.It Ic file
423.Pq Ic fi
424The same as
425.Ic folder .
426.It Ic folder
427.Pq Ic fo
428The
429.Ic folder
430command switches to a new mail file or folder.
431With no
432arguments, it tells you which file you are currently reading.
433If you give it an argument, it will write out changes (such
434as deletions) you have made in the current file and read in
435the new file.
436Some special conventions are recognized for
437the name.
438# means the previous file, % means your system
439mailbox, %user means user's system mailbox, & means
440your
441.Ar mbox
442file, and
443+folder means a file in your folder
444directory.
445.It Ic folders
446List the names of the folders in your folder directory.
447.It Ic from
448.Pq Ic f
449Takes a list of messages and prints their message headers.
450.It Ic headers
451.Pq Ic h
452Lists the current windowful of headers.
453To view the next or previous group of headers, see the
454.Ic z
455command.
456.It Ic help
457A synonym for
458.Ic \&? .
459.It Ic hold
460.Pf ( Ic ho ,
461also
462.Ic preserve )
463Takes a message list and marks each
464message therein to be saved in the
465user's system mailbox instead of in
466.Ar mbox .
467Does not override the
468.Ic delete
469command.
470.It Ic ignore
471Add the list of header fields named to the
472.Ar ignored list .
473Header fields in the ignore list are not printed
474on your terminal when you print a message.
475This
476command is very handy for suppression of certain machine-generated
477header fields.
478The
479.Ic Type
480and
481.Ic Print
482commands can be used to print a message in its entirety, including
483ignored fields.
484If
485.Ic ignore
486is executed with no arguments, it lists the current set of
487ignored fields.
488.It Ic inc
489Incorporate any new messages that have arrived while mail
490is being read.
491The new messages are added to the end of the message list,
492and the current message is reset to be the first new mail message.
493This does not renumber the existing message list, nor
494does it cause any changes made so far to be saved.
495.It Ic list
496.Pq Ic l
497List the valid
498.Nm
499commands.
500.It Ic mail
501.Pq Ic m
502Takes as argument login names and distribution group names and sends
503mail to those people.
504.It Ic mbox
505Indicate that a list of messages be sent to
506.Ar mbox
507in your home directory when you quit.
508This is the default
509action for messages if you do
510.Em not
511have the
512.Ic hold
513option set.
514.It Ic more
515.Pq Ic \&mo
516Takes a message list and invokes the pager on that list.
517.It Ic next
518.Pq Ic n
519(like
520.Ic +
521or
522.Tn CR )
523Goes to the next message in sequence and types it.
524With an argument list, types the next matching message.
525.It Ic preserve
526.Pq Ic pre
527A synonym for
528.Ic hold .
529.It Ic Print
530.Pq Ic P
531Like
532.Ic print
533but also prints out ignored header fields.
534See also
535.Ic print ,
536.Ic ignore ,
537and
538.Ic retain .
539.It Ic print
540.Pq Ic p
541Takes a message list and types out each message on the user's terminal.
542.It Ic quit
543.Pq Ic q
544Terminates the session, saving all undeleted, unsaved messages in
545the user's
546.Ar mbox
547file in his login directory, preserving all messages marked with
548.Ic hold
549or
550.Ic preserve
551or never referenced
552in his system mailbox, and removing all other messages from his system
553mailbox.
554If new mail has arrived during the session, the message
555.Dq Li "You have new mail"
556is given.
557If given while editing a
558mailbox file with the
559.Fl f
560flag, then the edit file is rewritten.
561A return to the shell is
562effected, unless the rewrite of edit file fails, in which case the user
563can escape with the
564.Ic exit
565command.
566.It Ic Reply
567.Pq Ic R
568Reply to originator.
569Does not reply to other
570recipients of the original message.
571.It Ic reply
572.Pq Ic r
573Takes a message list and sends mail to the sender and all
574recipients of the specified message.
575The default message must not be deleted.
576.It Ic respond
577A synonym for
578.Ic reply .
579.It Ic retain
580Add the list of header fields named to the
581.Ar retained list .
582Only the header fields in the retain list
583are shown on your terminal when you print a message.
584All other header fields are suppressed.
585The
586.Ic Type
587and
588.Ic Print
589commands can be used to print a message in its entirety.
590If
591.Ic retain
592is executed with no arguments, it lists the current set of
593retained fields.
594.It Ic save
595.Pq Ic s
596Takes a message list and a filename and appends each message in
597turn to the end of the file.
598The filename in quotes, followed by the line
599count and character count is echoed on the user's terminal.
600.It Ic saveignore
601.Ic saveignore
602is to
603.Ic save
604what
605.Ic ignore
606is to
607.Ic print
608and
609.Ic type .
610Header fields thus marked are filtered out when
611saving a message by
612.Ic save
613or when automatically saving to
614.Ar mbox .
615.It Ic saveretain
616.Ic saveretain
617is to
618.Ic save
619what
620.Ic retain
621is to
622.Ic print
623and
624.Ic type .
625Header fields thus marked are the only ones saved
626with a message when saving by
627.Ic save
628or when automatically saving to
629.Ar mbox .
630.Ic saveretain
631overrides
632.Ic saveignore .
633.It Ic set
634.Pq Ic se
635With no arguments, prints all variable values.
636Otherwise, sets
637option.
638Arguments are of the form
639.Ar option=value
640(no space before or after =) or
641.Ar option .
642Quotation marks may be placed around any part of the assignment statement to
643quote blanks or tabs, i.e.,
644.Ic set indentprefix="->" .
645.It Ic shell
646.Pq Ic sh
647Invokes an interactive version of the shell.
648.It Ic size
649Takes a message list and prints out the size in characters of each
650message.
651.It Ic source
652The
653.Ic source
654command reads
655commands from a file.
656.It Ic top
657Takes a message list and prints the top few lines of each.
658The number of
659lines printed is controlled by the variable
660.Ic toplines
661and defaults to five.
662.It Ic Type
663.Pq Ic T
664Identical to the
665.Ic Print
666command.
667.It Ic type
668.Pq Ic t
669A synonym for
670.Ic print .
671.It Ic unalias
672Takes a list of names defined by
673.Ic alias
674commands and discards the remembered groups of users.
675The group names
676no longer have any significance.
677.It Ic undelete
678.Pq Ic u
679Takes a message list and marks each message as not being deleted.
680.It Ic unread
681.Pq Ic U
682Takes a message list and marks each message as not having been read.
683.It Ic unset
684Takes a list of option names and discards their remembered values;
685the inverse of
686.Ic set .
687.It Ic visual
688.Pq Ic v
689Takes a message list and invokes the display editor on each message.
690.It Ic write
691.Pq Ic w
692Similar to
693.Ic save ,
694except that
695.Ic only
696the message body
697(without the header)
698is saved.
699Extremely useful for such tasks as sending and receiving source
700program text over the message system.
701.It Ic xit
702.Pq Ic x
703A synonym for
704.Ic exit .
705.It Ic z
706.Nm mail
707presents message headers in windowfuls as described under the
708.Ic headers
709command.
710You can move
711.Nm mail Ns 's
712attention forward to the next window with the
713.Ic z
714command.
715Also, you can move to the previous window by using
716.Ic z- .
717.El
718.Ss Tilde/escapes
719Here is a summary of the tilde escapes,
720which are used when composing messages to perform
721special functions.
722Tilde escapes are only recognized at the beginning
723of lines.
724The name
725.Dq tilde escape
726is somewhat of a misnomer since the actual escape character can be set
727by the option
728.Ic escape .
729.Pp
730.Bl -tag -width Ds -compact
731.It Ic ~b Ns Ar name ...
732Add the given names to the list of carbon copy recipients but do not make
733the names visible in the Cc: line ("blind" carbon copy).
734.Pp
735.It Ic ~c Ns Ar name ...
736Add the given names to the list of carbon copy recipients.
737.Pp
738.It Ic ~d
739Read the file
740.Pa dead.letter
741from your home directory into the message.
742.Pp
743.It Ic ~e
744Invoke the text editor on the message collected so far.
745After the
746editing session is finished, you may continue appending text to the
747message.
748.Pp
749.It Ic ~F Ns Ar messages
750Identical to
751.Ic ~f ,
752except all message headers are included.
753.Pp
754.It Ic ~f Ns Ar messages
755Read the named messages into the message being sent.
756If no messages are specified, read in the current message.
757Message headers currently being ignored (by the
758.Ic ignore
759or
760.Ic retain
761command) are not included.
762.Pp
763.It Ic ~h
764Edit the message header fields by typing each one in turn and allowing
765the user to append text to the end or modify the field by using the
766current terminal erase and kill characters.
767.Pp
768.It Ic ~M Ns Ar messages
769Identical to
770.Ic ~m ,
771except all message headers are included.
772.Pp
773.It Ic ~m Ns Ar messages
774Read the named messages into the message being sent, indented by a
775tab or by the value of
776.Va indentprefix .
777If no messages are specified,
778read the current message.
779Message headers currently being ignored (by the
780.Ic ignore
781or
782.Ic retain
783command) are not included.
784.Pp
785.It Ic ~p
786Print out the message collected so far, prefaced by the message header
787fields.
788.Pp
789.It Ic ~q
790Abort the message being sent, copying the message to
791.Pa dead.letter
792in your home directory if
793.Ic save
794is set.
795.Pp
796.It Ic ~r Ns Ar filename
797.It Ic ~< Ns Ar filename
798Read the named file into the message.
799.Pp
800.It Ic ~s Ns Ar string
801Cause the named string to become the current subject field.
802.Pp
803.It Ic ~t Ns Ar name ...
804Add the given names to the direct recipient list.
805.Pp
806.It Ic ~v
807Invoke an alternate editor (defined by the
808.Ev VISUAL
809option) on the
810message collected so far.
811Usually, the alternate editor will be a
812screen editor.
813After you quit the editor, you may resume appending
814text to the end of your message.
815.Pp
816.It Ic ~w Ns Ar filename
817Write the message onto the named file.
818.Pp
819.It Ic ~x
820Abort the message being sent.
821No message is copied to
822.Pa ~/dead.letter ,
823even if
824.Ic save
825is set.
826.Pp
827.It Ic ~?
828Prints a brief summary of tilde escapes.
829.Pp
830.It Ic ~! Ns Ar command
831Execute the indicated shell command, then return to the message.
832.Pp
833.It Ic ~| Ns Ar command
834Pipe the message through the command as a filter.
835If the command gives
836no output or terminates abnormally, retain the original text of the
837message.
838The command
839.Xr fmt 1
840is often used as
841.Ic command
842to rejustify the message.
843.Pp
844.It Ic ~: Ns Ar mail-command
845.It Ic ~_ Ns Ar mail-command
846Execute the given mail command.
847Not all commands, however, are allowed.
848.Pp
849.It Ic ~~ Ns Ar string
850Insert the string of text in the message prefaced by a single ~.
851If
852you have changed the escape character, then you should double
853that character in order to send it.
854.Pp
855.It Ic ~.
856Simulate end of file on input.
857.El
858.Ss Mail options
859Options are controlled via
860.Ic set
861and
862.Ic unset
863commands.
864Options may be either binary, in which case it is only
865significant to see whether they are set or not; or string, in which
866case the actual value is of interest.
867The binary options include the following:
868.Bl -tag -width append
869.It Ar append
870Causes messages saved in
871.Ar mbox
872to be appended to the end rather than prepended.
873This should always be set (perhaps in
874.Pa /etc/mail.rc ) .
875.It Ar ask , asksub
876Causes
877.Nm mail
878to prompt you for the subject of each message you send.
879If
880you respond with simply a newline, no subject field will be sent.
881.It Ar askbcc
882Causes you to be prompted for additional blind carbon copy recipients at the
883end of each message.
884Responding with a newline indicates your
885satisfaction with the current list.
886.It Ar askcc
887Causes you to be prompted for additional carbon copy recipients at the
888end of each message.
889Responding with a newline indicates your
890satisfaction with the current list.
891.It Ar autoinc
892Causes new mail to be automatically incorporated when it arrives.
893Setting this is similar to issuing the
894.Ic inc
895command at each prompt, except that the current message is not
896reset when new mail arrives.
897.It Ar autoprint
898Causes the
899.Ic delete
900command to behave like
901.Ic dp ;
902thus, after deleting a message, the next one will be typed
903automatically.
904.It Ar debug
905Setting the binary option
906.Ar debug
907is the same as specifying
908.Fl d
909on the command line and causes
910.Nm mail
911to output all sorts of information useful for debugging
912.Nm mail .
913.It Ar dot
914The binary option
915.Ar dot
916causes
917.Nm mail
918to interpret a period alone on a line as the terminator
919of a message you are sending.
920.It Ar hold
921This option is used to hold messages in the system mailbox
922by default.
923.It Ar ignore
924Causes interrupt signals from your terminal to be ignored and echoed as
925@'s.
926.It Ar ignoreeof
927An option related to
928.Ar dot
929is
930.Ar ignoreeof
931which makes
932.Nm mail
933refuse to accept a control-D as the end of a message.
934.Ar ignoreeof
935also applies to
936.Nm mail
937command mode.
938.It Ar keep
939Setting this option causes
940.Nm
941to truncate your system mailbox instead of deleting it
942when it's empty.
943.It Ar keepsave
944Messages saved with the
945.Ic save
946command are not normally saved in
947.Ar mbox
948at quit time.
949Use this option to retain those messages.
950.It Ar metoo
951Usually, when a group is expanded that contains the sender, the sender
952is removed from the expansion.
953Setting this option causes the sender
954to be included in the group.
955.It Ar noheader
956Setting the option
957.Ar noheader
958is the same as giving the
959.Fl N
960flag on the command line.
961.It Ar nosave
962Normally, when you abort a message with two interrupt characters
963(usually control-C),
964.Nm mail
965copies the partial letter to the file
966.Pa dead.letter
967in your home directory.
968Setting the binary option
969.Ar nosave
970prevents this.
971.It Ar quiet
972Suppresses the printing of the version when first invoked.
973.It Ar Replyall
974Reverses the sense of
975.Ic reply
976and
977.Ic Reply
978commands.
979.It Ar searchheaders
980If this option is set, then a message-list specifier in the form
981.Dq /x:y
982will expand to all messages containing the substring
983.Sq y
984in the header
985field
986.Sq x .
987The string search is case insensitive.
988If
989.Sq x
990is omitted, it will default to the
991.Dq Subject
992header field.
993The form
994.Dq /to:y
995is a special case, and will expand
996to all messages containing the substring
997.Sq y
998in the
999.Dq To ,
1000.Dq Cc
1001or
1002.Dq Bcc
1003header fields.
1004The check for
1005.Dq to
1006is case sensitive, so that
1007.Dq /To:y
1008can be used to limit the search for
1009.Sq y
1010to just the
1011.Dq To:
1012field.
1013.It Ar skipempty
1014Don't send messages with an empty body.
1015.It Ar verbose
1016Setting the option
1017.Ar verbose
1018is the same as using the
1019.Fl v
1020flag on the command line.
1021When
1022.Nm
1023runs in verbose mode,
1024the actual delivery of messages is displayed on the user's
1025terminal.
1026.El
1027.Ss Option string values
1028.Bl -tag -width Va
1029.It Ev EDITOR
1030Pathname of the text editor to use in the
1031.Ic edit
1032command and
1033.Ic ~e
1034escape.
1035If not defined,
1036.Pa /usr/bin/ex
1037is used.
1038.It Ev LISTER
1039Pathname of the directory lister to use in the
1040.Ic folders
1041command.
1042Default is
1043.Pa /bin/ls .
1044.It Ev MBOX
1045The name of the
1046.Ar mbox
1047file.
1048It can be the name of a folder.
1049The default is
1050.Dq Li mbox
1051in the user's home directory.
1052.It Ev PAGER
1053Pathname of the program to use in the
1054.Ic more
1055command or when the
1056.Ar crt
1057variable is set.
1058The default paginator
1059.Xr more 1
1060is used if this option is not defined.
1061.It Ev SHELL
1062Pathname of the shell to use in the
1063.Ic !\&
1064command and the
1065.Ic ~!\&
1066escape.
1067A default shell is used if this option is
1068not defined.
1069.It Ev TMPDIR
1070Directory in which temporary files are stored.
1071.It Ev VISUAL
1072Pathname of the text editor to use in the
1073.Ic visual
1074command and
1075.Ic ~v
1076escape.
1077If not defined,
1078.Pa /usr/bin/vi
1079is used.
1080.It Ar crt
1081The valued option
1082.Ar crt
1083is used as a threshold to determine how long a message must
1084be before
1085.Ev PAGER
1086is used to read it.
1087If
1088.Ar crt
1089is set without a value,
1090then the height of the terminal screen stored in the system
1091is used to compute the threshold (see
1092.Xr stty 1 ) .
1093.It Ar escape
1094If defined, the first character of this option gives the character to
1095use in the place of ~ to denote escapes.
1096.It Ar folder
1097The name of the directory to use for storing folders of
1098messages.
1099If this name begins with a
1100.Ql / ,
1101.Nm mail
1102considers it to be an absolute pathname; otherwise, the
1103folder directory is found relative to your home directory.
1104.It Ar indentprefix
1105String used by the
1106.Ic ~m
1107tilde escape for indenting messages, in place of the normal tab character
1108.Pq Sq ^I .
1109Be sure to quote the value if it contains
1110spaces or tabs.
1111.It Ar record
1112If defined, gives the pathname of the file used to record all outgoing
1113mail.
1114If not defined, then outgoing mail is not so saved.
1115.It Ar screen
1116Size of window of message headers for
1117.Ic z .
1118.It Ar sendmail
1119Pathname to an alternative mail delivery system.
1120.It Ar toplines
1121If defined, gives the number of lines of a message to be printed out
1122with the
1123.Ic top
1124command; normally, the first five lines are printed.
1125.El
1126.Sh ENVIRONMENT
1127.Nm mail
1128utilizes the
1129.Ev HOME ,
1130.Ev LOGNAME ,
1131.Ev MAIL ,
1132.Ev MAILRC ,
1133and
1134.Ev USER
1135environment variables.
1136.Pp
1137If the
1138.Ev MAIL
1139environment variable is set, its value is used as the path to the
1140user's mail spool.
1141.Sh FILES
1142.Bl -tag -width /usr/share/misc/mail.*help -compact
1143.It Pa /var/mail/*
1144post office (unless overridden by the
1145.Ev MAIL
1146environment variable)
1147.It ~/mbox
1148user's old mail
1149.It ~/.mailrc
1150file giving initial mail commands; can be overridden by setting the
1151.Ev MAILRC
1152environment variable
1153.It Pa /tmp/R*
1154temporary files
1155.It Pa /usr/share/misc/mail.*help
1156help files
1157.It Pa /etc/mail.rc
1158system initialization file
1159.El
1160.Sh EXIT STATUS
1161.Ex -std mail
1162.Sh SEE ALSO
1163.Xr fmt 1 ,
1164.Xr lockspool 1 ,
1165.Xr vacation 1 ,
1166.Xr aliases 5 ,
1167.Xr mailaddr 7 ,
1168.Xr mail.local 8 ,
1169.Xr newaliases 8 ,
1170.Xr sendmail 8 ,
1171.Xr smtpd 8
1172.Sh STANDARDS
1173The
1174.Nm mailx
1175utility is compliant with the
1176.St -p1003.1-2008
1177specification.
1178.Pp
1179The flags
1180.Op Fl iNnu
1181are marked by
1182.St -p1003.1-2008
1183as being optional.
1184.Pp
1185The flags
1186.Op Fl eFH
1187are marked by
1188.St -p1003.1-2008
1189as being optional,
1190and are not supported by this implementation of
1191.Nm mailx .
1192.Pp
1193The flags
1194.Op Fl bcdEIv
1195are extensions to the specification.
1196.Sh HISTORY
1197A
1198.Nm mail
1199command appeared in
1200.At v3 .
1201This man page is derived from the
1202.%T "Mail Reference Manual"
1203originally written by Kurt Shoens.
1204.Sh BUGS
1205There are some flags that are not documented here.
1206Most are
1207not useful to the general user.
1208.Pp
1209Usually,
1210.Nm mail
1211and
1212.Nm mailx
1213are just links to
1214.Nm Mail ,
1215which can be confusing.
1216