give a message in "delayed" messages caused by name server timeouts
[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.\"
2e55f625 6.\" @(#)mail.1 8.4 (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.
b14a7a4a
CL
453.It Ic mail
454.Pq Ic m
b5dc1377 455Takes as argument login names and distribution group names and sends
91d7df00 456mail to those people.
b14a7a4a 457.It Ic mbox
dcee403d 458Indicate that a list of messages be sent to
b5dc1377 459.Ic mbox
b14a7a4a
CL
460in your home directory when you quit.
461This is the default
dcee403d 462action for messages if you do
b5dc1377 463.Em not
dcee403d 464have the
b5dc1377 465.Ic hold
dcee403d 466option set.
b14a7a4a
CL
467.It Ic next
468.Pq Ic n
b5dc1377
CL
469like
470.Ic \&+
b14a7a4a
CL
471or
472.Tn CR )
473Goes to the next message in sequence and types it.
91d7df00 474With an argument list, types the next matching message.
b14a7a4a
CL
475.It Ic preserve
476.Pq Ic pre
91d7df00 477A synonym for
b5dc1377 478.Ic hold .
b14a7a4a
CL
479.It Ic print
480.Pq Ic p
dcee403d 481Takes a message list and types out each message on the user's terminal.
b14a7a4a
CL
482.It Ic quit
483.Pq Ic q
b5dc1377 484Terminates the session, saving all undeleted, unsaved messages in
91d7df00 485the user's
b5dc1377 486.Ar mbox
91d7df00 487file in his login directory, preserving all messages marked with
b5dc1377 488.Ic hold
91d7df00 489or
b5dc1377 490.Ic preserve
91d7df00
KM
491or never referenced
492in his system mailbox, and removing all other messages from his system
b14a7a4a
CL
493mailbox.
494If new mail has arrived during the session, the message
495.Dq Li "You have new mail"
496is given.
497If given while editing a
91d7df00 498mailbox file with the
b5dc1377 499.Fl f
b14a7a4a
CL
500flag, then the edit file is rewritten.
501A return to the Shell is
91d7df00
KM
502effected, unless the rewrite of edit file fails, in which case the user
503can escape with the
b5dc1377 504.Ic exit
91d7df00 505command.
b14a7a4a
CL
506.It Ic reply
507.Pq Ic r
dcee403d
KM
508Takes a message list and sends mail to the sender and all
509recipients of the specified message.
510The default message must not be deleted.
b14a7a4a 511.It Ic respond
91d7df00 512A synonym for
b5dc1377 513.Ic reply .
b14a7a4a 514.It Ic retain
bb04cec6 515Add the list of header fields named to the
b5dc1377 516.Ar retained list
bb04cec6
KM
517Only the header fields in the retain list
518are shown on your terminal when you print a message.
519All other header fields are suppressed.
520The
b5dc1377 521.Ic Type
bb04cec6 522and
b5dc1377 523.Ic Print
bb04cec6
KM
524commands can be used to print a message in its entirety.
525If
b5dc1377 526.Ic retain
bb04cec6
KM
527is executed with no arguments, it lists the current set of
528retained fields.
b14a7a4a
CL
529.It Ic save
530.Pq Ic s
b5dc1377 531Takes a message list and a filename and appends each message in
b14a7a4a
CL
532turn to the end of the file.
533The filename in quotes, followed by the line
b5dc1377 534count and character count is echoed on the user's terminal.
b14a7a4a
CL
535.It Ic set
536.Pq Ic se
537With no arguments, prints all variable values.
538Otherwise, sets
539option.
540Arguments are of the form
b5dc1377 541.Ar option=value
bb04cec6 542(no space before or after =) or
b5dc1377 543.Ar option .
692b0644 544Quotation marks may be placed around any part of the assignment statement to
b5dc1377 545quote blanks or tabs, i.e.
b14a7a4a
CL
546.Dq Li "set indentprefix=\*q->\*q"
547.It Ic saveignore
b5dc1377
CL
548.Ic Saveignore
549is to
550.Ic save
551what
552.Ic ignore
553is to
554.Ic print
555and
556.Ic type .
557Header fields thus marked are filtered out when
558saving a message by
559.Ic save
560or when automatically saving to
561.Ar mbox .
2e55f625 562.pl +1
b14a7a4a 563.It Ic saveretain
b5dc1377
CL
564.Ic Saveretain
565is to
566.Ic save
567what
568.Ic retain
569is to
570.Ic print
571and
572.Ic type .
573Header fields thus marked are the only ones saved
574with a message when saving by
575.Ic save
576or when automatically saving to
577.Ar mbox .
578.Ic Saveretain
579overrides
580.Ic saveignore .
b14a7a4a
CL
581.It Ic shell
582.Pq Ic sh
b5dc1377 583Invokes an interactive version of the shell.
b14a7a4a 584.It Ic size
91d7df00
KM
585Takes a message list and prints out the size in characters of each
586message.
b14a7a4a 587.It Ic source
dcee403d 588The
b5dc1377 589.Ic source
dcee403d 590command reads
dcee403d 591commands from a file.
b14a7a4a
CL
592.It Ic top
593Takes a message list and prints the top few lines of each.
594The number of
91d7df00 595lines printed is controlled by the variable
b5dc1377 596.Ic toplines
91d7df00 597and defaults to five.
b14a7a4a
CL
598.It Ic type
599.Pq Ic t
b5dc1377
CL
600A synonym for
601.Ic print .
b14a7a4a 602.It Ic unalias
91d7df00 603Takes a list of names defined by
b5dc1377 604.Ic alias
b14a7a4a
CL
605commands and discards the remembered groups of users.
606The group names
91d7df00 607no longer have any significance.
b14a7a4a
CL
608.It Ic undelete
609.Pq Ic u
b5dc1377
CL
610Takes a message list and marks each message as
611.Ic not
91d7df00 612being deleted.
b14a7a4a
CL
613.It Ic unread
614.Pq Ic U
b5dc1377
CL
615Takes a message list and marks each message as
616.Ic not
634278dc 617having been read.
b14a7a4a 618.It Ic unset
91d7df00
KM
619Takes a list of option names and discards their remembered values;
620the inverse of
b5dc1377 621.Ic set .
b14a7a4a
CL
622.It Ic visual
623.Pq Ic v
b5dc1377 624Takes a message list and invokes the display editor on each message.
b14a7a4a
CL
625.It Ic write
626.Pq Ic w
b5dc1377
CL
627Similar to
628.Ic save ,
b3f2d791 629except that
b5dc1377
CL
630.Ic only
631the message body
b14a7a4a 632.Pq Ar without
b5dc1377 633the header) is saved.
b3f2d791
S
634Extremely useful for such tasks as sending and receiving source
635program text over the message system.
b14a7a4a
CL
636.It Ic xit
637.Pq Ic x
b5dc1377
CL
638A synonym for
639.Ic exit .
b14a7a4a 640.It Ic z
b5dc1377 641.Nm Mail
dcee403d 642presents message headers in windowfuls as described under the
b5dc1377 643.Ic headers
b14a7a4a
CL
644command.
645You can move
646.Nm mail Ns 's
dcee403d 647attention forward to the next window with the
b5dc1377 648.Ic \&z
b14a7a4a
CL
649command.
650Also, you can move to the previous window by using
b5dc1377 651.Ic \&z\&\- .
b14a7a4a 652.El
b5dc1377
CL
653.Ss Tilde/Escapes
654.Pp
91d7df00
KM
655Here is a summary of the tilde escapes,
656which are used when composing messages to perform
b14a7a4a
CL
657special functions.
658Tilde escapes are only recognized at the beginning
659of lines.
660The name
b5dc1377 661.Dq Em tilde\ escape
91d7df00
KM
662is somewhat of a misnomer since the actual escape character can be set
663by the option
b5dc1377 664.Ic escape .
b14a7a4a
CL
665.Bl -tag -width Ds
666.It Ic \&~! Ns Ar command
91d7df00 667Execute the indicated shell command, then return to the message.
b14a7a4a 668.It Ic \&~b Ns Ar name ...
cb530a2d
KM
669Add the given names to the list of carbon copy recipients but do not make
670the names visible in the Cc: line ("blind" carbon copy).
b14a7a4a 671.It Ic \&~c Ns Ar name ...
91d7df00 672Add the given names to the list of carbon copy recipients.
b14a7a4a 673.It Ic \&~d
b5dc1377
CL
674Read the file
675.Dq Pa dead.letter
676from your home directory into the message.
b14a7a4a
CL
677.It Ic \&~e
678Invoke the text editor on the message collected so far.
679After the
91d7df00
KM
680editing session is finished, you may continue appending text to the
681message.
b14a7a4a 682.It Ic \&~f Ns Ar messages
dcee403d
KM
683Read the named messages into the message being sent.
684If no messages are specified, read in the current message.
b5dc1377
CL
685Message headers currently being ignored (by the
686.Ic ignore
687or
688.Ic retain
84931b71 689command) are not included.
2e55f625 690.ne 1i
b14a7a4a 691.It Ic \&~F Ns Ar messages
b5dc1377 692Identical to
5325ced3 693.Ic \&~f ,
b5dc1377 694except all message headers are included.
b14a7a4a 695.It Ic \&~h
91d7df00
KM
696Edit the message header fields by typing each one in turn and allowing
697the user to append text to the end or modify the field by using the
698current terminal erase and kill characters.
b14a7a4a 699.It Ic \&~m Ns Ar messages
0f642f7e 700Read the named messages into the message being sent, indented by a
b5dc1377
CL
701tab or by the value of
702.Ar indentprefix .
703If no messages are specified,
84931b71 704read the current message.
b5dc1377
CL
705Message headers currently being ignored (by the
706.Ic ignore
707or
708.Ic retain
84931b71 709command) are not included.
b14a7a4a 710.It Ic \&~M Ns Ar messages
b5dc1377
CL
711Identical to
712.Ic \&~m ,
713except all message headers are included.
b14a7a4a 714.It Ic \&~p
91d7df00
KM
715Print out the message collected so far, prefaced by the message header
716fields.
b14a7a4a 717.It Ic \&~q
91d7df00 718Abort the message being sent, copying the message to
b5dc1377 719.Dq Pa dead.letter
91d7df00 720in your home directory if
b5dc1377 721.Ic save
91d7df00 722is set.
b14a7a4a 723.It Ic \&~r Ns Ar filename
91d7df00 724Read the named file into the message.
b14a7a4a 725.It Ic \&~s Ns Ar string
91d7df00 726Cause the named string to become the current subject field.
b14a7a4a 727.It Ic \&~\&t Ns Ar name ...
91d7df00 728Add the given names to the direct recipient list.
b14a7a4a
CL
729.It Ic \&~\&v
730Invoke an alternate editor (defined by the
731.Ev VISUAL
732option) on the
733message collected so far.
734Usually, the alternate editor will be a
735screen editor.
736After you quit the editor, you may resume appending
91d7df00 737text to the end of your message.
b14a7a4a 738.It Ic \&~w Ns Ar filename
91d7df00 739Write the message onto the named file.
b14a7a4a
CL
740.It Ic \&~\&| Ns Ar command
741Pipe the message through the command as a filter.
742If the command gives
91d7df00 743no output or terminates abnormally, retain the original text of the
b14a7a4a
CL
744message.
745The command
746.Xr fmt 1
91d7df00 747is often used as
b5dc1377 748.Ic command
91d7df00 749to rejustify the message.
b14a7a4a
CL
750.It Ic \&~: Ns Ar mail-command
751Execute the given mail command.
752Not all commands, however, are allowed.
753.It Ic \&~~ Ns Ar string
754Insert the string of text in the message prefaced by a single ~.
755If
91d7df00
KM
756you have changed the escape character, then you should double
757that character in order to send it.
b14a7a4a 758.El
b5dc1377
CL
759.Ss Mail Options
760Options are controlled via
761.Ic set
91d7df00 762and
b5dc1377 763.Ic unset
b14a7a4a
CL
764commands.
765Options may be either binary, in which case it is only
bfe02f44 766significant to see whether they are set or not; or string, in which
91d7df00
KM
767case the actual value is of interest.
768The binary options include the following:
b14a7a4a
CL
769.Bl -tag -width append
770.It Ar append
91d7df00 771Causes messages saved in
b5dc1377 772.Ar mbox
91d7df00 773to be appended to the end rather than prepended.
5325ced3 774This should always be set (perhaps in
0617321e 775.Pa /etc/mail.rc ) .
b14a7a4a 776.It Ar ask
91d7df00 777Causes
b5dc1377 778.Nm mail
b14a7a4a
CL
779to prompt you for the subject of each message you send.
780If
91d7df00 781you respond with simply a newline, no subject field will be sent.
2e55f625 782.ne 1i
b14a7a4a 783.It Ar askcc
91d7df00 784Causes you to be prompted for additional carbon copy recipients at the
b14a7a4a
CL
785end of each message.
786Responding with a newline indicates your
91d7df00 787satisfaction with the current list.
b14a7a4a 788.It Ar autoprint
91d7df00 789Causes the
b5dc1377 790.Ic delete
91d7df00 791command to behave like
b5dc1377 792.Ic dp
91d7df00
KM
793\- thus, after deleting a message, the next one will be typed
794automatically.
b14a7a4a 795.It Ar debug
dcee403d 796Setting the binary option
b5dc1377 797.Ar debug
dcee403d 798is the same as specifying
b5dc1377 799.Fl d
dcee403d 800on the command line and causes
b5dc1377 801.Nm mail
dcee403d 802to output all sorts of information useful for debugging
b5dc1377 803.Nm mail .
b14a7a4a 804.It Ar dot
dcee403d 805The binary option
b5dc1377 806.Ar dot
dcee403d 807causes
b5dc1377 808.Nm mail
dcee403d
KM
809to interpret a period alone on a line as the terminator
810of a message you are sending.
b14a7a4a 811.It Ar hold
dcee403d
KM
812This option is used to hold messages in the system mailbox
813by default.
b14a7a4a 814.It Ar ignore
91d7df00
KM
815Causes interrupt signals from your terminal to be ignored and echoed as
816@'s.
b14a7a4a 817.It Ar ignoreeof
dcee403d 818An option related to
b5dc1377 819.Ar dot
dcee403d 820is
b5dc1377 821.Ar ignoreeof
dcee403d 822which makes
b5dc1377 823.Nm mail
dcee403d 824refuse to accept a control-d as the end of a message.
b5dc1377 825.Ar Ignoreeof
dcee403d 826also applies to
b5dc1377 827.Nm mail
dcee403d 828command mode.
b14a7a4a 829.It Ar metoo
91d7df00 830Usually, when a group is expanded that contains the sender, the sender
b14a7a4a
CL
831is removed from the expansion.
832Setting this option causes the sender
91d7df00 833to be included in the group.
b14a7a4a 834.It Ar noheader
84931b71 835Setting the option
b5dc1377 836.Ar noheader
84931b71 837is the same as giving the
b5dc1377 838.Fl N
84931b71 839flag on the command line.
b14a7a4a 840.It Ar nosave
b5dc1377 841Normally, when you abort a message with two
b14a7a4a 842.Tn RUBOUT
b5dc1377
CL
843(erase or delete)
844.Nm mail
845copies the partial letter to the file
846.Dq Pa dead.letter
b14a7a4a
CL
847in your home directory.
848Setting the binary option
b5dc1377 849.Ar nosave
dcee403d 850prevents this.
b14a7a4a 851.It Ar Replyall
634278dc 852Reverses the sense of
b5dc1377 853.Ic reply
634278dc 854and
b5dc1377 855.Ic Reply
634278dc 856commands.
b14a7a4a 857.It Ar quiet
91d7df00 858Suppresses the printing of the version when first invoked.
c2e1b7e6
EW
859.It Ar searchheaders
860If this option is set, then a message-list specifier in the form ``/x:y''
861will expand to all messages containing the substring ``y'' in the header
862field ``x''. The string search is case insensitive.
b14a7a4a 863.It Ar verbose
dcee403d 864Setting the option
b5dc1377 865.Ar verbose
dcee403d 866is the same as using the
b5dc1377 867.Fl v
b14a7a4a
CL
868flag on the command line.
869When mail runs in verbose mode,
af143eb3 870the actual delivery of messages is displayed on the user's
dcee403d 871terminal.
b14a7a4a 872.El
b5dc1377 873.Ss Option String Values
b14a7a4a
CL
874.Bl -tag -width Va
875.It Ev EDITOR
91d7df00 876Pathname of the text editor to use in the
b5dc1377
CL
877.Ic edit
878command and
879.Ic \&~e
b14a7a4a
CL
880escape.
881If not defined, then a default editor is used.
882.It Ev LISTER
84931b71 883Pathname of the directory lister to use in the
b5dc1377 884.Ic folders
b14a7a4a
CL
885command.
886Default is
b5dc1377 887.Pa /bin/ls .
b14a7a4a 888.It Ev PAGER
634278dc 889Pathname of the program to use in the
b5dc1377 890.Ic more
634278dc 891command or when
b5dc1377 892.Ic crt
b14a7a4a
CL
893variable is set.
894The default paginator
b5dc1377 895.Xr more 1
692b0644 896is used if this option is not defined.
b14a7a4a 897.It Ev SHELL
91d7df00 898Pathname of the shell to use in the
b5dc1377
CL
899.Ic \&!
900command and the
901.Ic \&~!
b14a7a4a
CL
902escape.
903A default shell is used if this option is
91d7df00 904not defined.
b14a7a4a 905.It Ev VISUAL
91d7df00 906Pathname of the text editor to use in the
b5dc1377
CL
907.Ic visual
908command and
909.Ic \&~v
910escape.
2e55f625 911.ne 1i
b14a7a4a 912.It Va crt
dcee403d 913The valued option
b5dc1377 914.Va crt
dcee403d
KM
915is used as a threshold to determine how long a message must
916be before
b14a7a4a
CL
917.Ev PAGER
918is used to read it.
919If
b5dc1377
CL
920.Va crt
921is set without a value,
84931b71 922then the height of the terminal screen stored in the system
b5dc1377
CL
923is used to compute the threshold (see
924.Xr stty 1 ) .
b14a7a4a 925.It Ar escape
91d7df00
KM
926If defined, the first character of this option gives the character to
927use in the place of ~ to denote escapes.
b14a7a4a 928.It Ar folder
dcee403d 929The name of the directory to use for storing folders of
b14a7a4a
CL
930messages.
931If this name begins with a `/',
b5dc1377 932.Nm mail
dcee403d
KM
933considers it to be an absolute pathname; otherwise, the
934folder directory is found relative to your home directory.
b14a7a4a 935.It Ev MBOX
b5dc1377
CL
936The name of the
937.Ar mbox
b14a7a4a
CL
938file.
939It can be the name of a folder.
b5dc1377
CL
940The default is
941.Dq Li mbox
942in the user's home directory.
b14a7a4a 943.It Ar record
91d7df00 944If defined, gives the pathname of the file used to record all outgoing
b14a7a4a
CL
945mail.
946If not defined, then outgoing mail is not so saved.
947.It Ar indentprefix
0f642f7e 948String used by the ``~m'' tilde escape for indenting messages, in place of
b14a7a4a
CL
949the normal tab character (^I).
950Be sure to quote the value if it contains
692b0644 951spaces or tabs.
b14a7a4a 952.It Ar toplines
91d7df00
KM
953If defined, gives the number of lines of a message to be printed out
954with the
b5dc1377 955.Ic top
91d7df00 956command; normally, the first five lines are printed.
b14a7a4a 957.El
b5dc1377
CL
958.Sh ENVIRONMENT
959.Nm Mail
960utilizes the
961.Ev HOME
962and
963.Ev USER
964environment variables.
965.Sh FILES
b14a7a4a
CL
966.Bl -tag -width /usr/share/misc/Mail.help* -compact
967.It Pa /var/spool/mail/*
968Post office.
969.It ~/mbox
970User's old mail.
971.It ~/.mailrc
972File giving initial mail commands.
973.It Pa /tmp/R*
974Temporary files.
975.It Pa /usr/share/misc/Mail.help*
976Help files.
0617321e 977.It Pa /etc/mail.rc
b14a7a4a
CL
978System initialization file.
979.El
b5dc1377 980.Sh SEE ALSO
b5dc1377
CL
981.Xr fmt 1 ,
982.Xr newaliases 1 ,
983.Xr vacation 1 ,
984.Xr aliases 5 ,
985.Xr mailaddr 7 ,
986.Xr sendmail 8
987and
b14a7a4a
CL
988.Rs
989.%T "The Mail Reference Manual" .
990.Re
b5dc1377
CL
991.Sh HISTORY
992A
993.Nm mail
994command
b14a7a4a
CL
995appeared in
996.At v6 .
b5dc1377 997This man page is derived from
b14a7a4a 998.%T "The Mail Reference Manual"
b5dc1377
CL
999originally written by Kurt Shoens.
1000.Sh BUGS
b14a7a4a
CL
1001There are some flags that are not documented here.
1002Most are
dcee403d 1003not useful to the general user.
b5dc1377 1004.Pp
dcee403d 1005Usually,
b5dc1377 1006.Nm mail
dcee403d 1007is just a link to
b5dc1377 1008.Nm Mail ,
dcee403d 1009which can be confusing.