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