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