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