grammar
[unix-history] / usr / src / usr.bin / mail / mail.1
CommitLineData
91d7df00
KM
1.\" Copyright (c) 1980 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
bfe02f44 5.\" @(#)mail.1 6.6 (Berkeley) %G%
91d7df00 6.\"
bb04cec6 7.TH MAIL 1 ""
91d7df00
KM
8.UC 4
9.SH NAME
10mail \- send and receive mail
11.SH SYNOPSIS
12.B mail
13[
dcee403d
KM
14.B \-v
15]
16[
17.B \-i
18]
19[
20.B \-n
21]
22[
23.B \-s
24subject
25]
26[
27user ...
28]
29.br
30.B mail
31[
32.B \-v
33]
34[
35.B \-i
36]
37[
38.B \-n
39]
91d7df00
KM
40.B \-f
41[
42name
43]
dcee403d
KM
44.br
45.B mail
46[
47.B \-v
91d7df00
KM
48]
49[
dcee403d 50.B \-i
91d7df00 51]
dcee403d
KM
52[
53.B \-n
54]
55.B \-u
56user
91d7df00
KM
57.SH INTRODUCTION
58.I Mail
59is a intelligent mail processing system, which has
60a command syntax reminiscent of
61.I ed
62with lines replaced by messages.
63.PP
dcee403d
KM
64The
65.B \-v
66flag puts mail into verbose mode; the details of
67delivery are displayed on the users terminal.
68The
69.B \-i
70flag causes tty interrupt signals to be ignored. This is
71particularly useful when using
72.I mail
73on noisy phone lines.
74The
75.B \-n
76flag inhibits the reading of /usr/lib/Mail.rc.
77.PP
91d7df00 78.I "Sending mail.\ "
bfe02f44 79To send a message to one or more people,
91d7df00 80.I mail
bfe02f44
AH
81can be invoked with arguments which are the names of people to
82whom the mail will be sent. You are then expected to type in
83your message, followed
91d7df00 84by an \s-2EOT\s0 (control\-D) at the beginning of a line.
dcee403d
KM
85A subject may be specified on the command line by using the
86.B \-s
87flag. (Only the first argument after the
88.B \-s
89flag is used as a subject; be careful to quote subjects
90containing spaces.)
91d7df00
KM
91The section below, labeled
92.I "Replying to or originating mail,"
93describes some features of
94.I mail
95available to help you compose your letter.
96.PP
97.I "Reading mail.\ "
dcee403d 98In normal usage
91d7df00
KM
99.I mail
100is given no arguments and checks your mail out of the
101post office, then
dcee403d 102prints out a one line header of each message there.
91d7df00
KM
103The current message is initially the first message (numbered 1)
104and can be printed using the
105.B print
106command (which can be abbreviated \fBp\fR).
107You can move among the messages much as you move between lines in
dcee403d 108.IR ed ,
91d7df00 109with the commands `+' and `\-' moving backwards and forwards, and
dcee403d 110simple numbers.
91d7df00
KM
111.PP
112.I "Disposing of mail.\ "
113After examining a message you can
114.B delete
115(\fBd\fR)
116the message or
117.B reply
118(\fBr\fR)
119to it.
120Deletion causes the
121.I mail
122program to forget about the message.
dcee403d 123This is not irreversible; the message can be
91d7df00
KM
124.B undeleted
125(\fBu\fR)
126by giving its number, or the
127.I mail
128session can be aborted by giving the
129.B exit
130(\fBx\fR)
131command.
132Deleted messages will, however, usually disappear never to be seen again.
133.PP
134.I "Specifying messages.\ "
135Commands such as
136.B print
137and
138.B delete
dcee403d 139can be given a list of message numbers as arguments to apply
91d7df00
KM
140to a number of messages at once.
141Thus ``delete 1 2'' deletes messages 1 and 2, while ``delete 1\-5''
142deletes messages 1 through 5.
143The special name ``*'' addresses all messages, and ``$'' addresses
144the last message; thus the command
145.B top
146which prints the first few lines of a message could be used in
147``top *'' to print the first few lines of all messages.
148.PP
149.I "Replying to or originating mail.\ "
150You can use the
151.B reply
152command to
153set up a response to a message, sending it back to the
154person who it was from.
dcee403d
KM
155Text you then type in, up to an end-of-file,
156defines the contents of the message.
91d7df00
KM
157While you are composing a message,
158.I mail
159treats lines beginning with the character `~' specially.
160For instance, typing ``~m'' (alone on a line) will place a copy
161of the current message into the response right shifting it by a tabstop.
162Other escapes will set up subject fields, add and delete recipients
163to the message and allow you to escape to an editor to revise the
164message or to a shell to run some commands. (These options
dcee403d 165are given in the summary below.)
91d7df00
KM
166.PP
167.I "Ending a mail processing session.\ "
168You can end a
169.I mail
170session with the
171.B quit
172(\fBq\fR)
173command.
174Messages which have been examined go to your
175.I mbox
176file unless they have been deleted in which case they are discarded.
177Unexamined messages go back to the post office.
178The
179.B \-f
180option causes
181.I mail
182to read in the contents of your
183.I mbox
184(or the specified file)
185for processing; when you
dcee403d 186.BR quit ,
91d7df00
KM
187.I mail
188writes undeleted messages back to this file.
dcee403d
KM
189The
190.B \-u
191flag is a short way of doing
192"mail
193.B \-f
194/usr/spool/mail/user".
91d7df00
KM
195.PP
196.I "Personal and systemwide distribution lists.\ "
197It is also possible to create a personal distribution lists so that,
198for instance, you can send mail to ``cohorts'' and have it go
199to a group of people.
200Such lists can be defined by placing a line like
201.IP
dcee403d 202alias cohorts bill ozalp jkf mark kridle@ucbcory
91d7df00
KM
203.PP
204in the file \&.mailrc in your home directory.
dcee403d 205The current list of such aliases can be displayed with the
91d7df00
KM
206.B alias
207.B (a)
208command in
dcee403d 209.IR mail .
91d7df00
KM
210System wide distribution lists can be created by editing
211/usr/lib/aliases, see
212.IR aliases (5)
213and
dcee403d
KM
214.IR sendmail (8);
215these are kept in a different syntax.
91d7df00
KM
216In mail you send, personal aliases will be expanded in mail sent
217to others so that they will be able to \fBreply\fR to the recipients.
218System wide \fIaliases\fR are not expanded when the mail is sent,
219but any reply returned to the machine will have the system wide
220alias expanded as all mail goes through
dcee403d 221.IR sendmail .
91d7df00
KM
222.PP
223.I "Network mail (ARPA, UUCP, Berknet)\ "
dcee403d
KM
224See
225.IR mailaddr(7)
226for a description of network addresses.
91d7df00
KM
227.PP
228.I Mail
dcee403d 229has a number of options which can be set in the
91d7df00
KM
230.I \&.mailrc
231file to alter its behavior; thus ``set askcc'' enables the ``askcc''
232feature. (These options are summarized below.)
233.SH SUMMARY
234(Adapted from the `Mail Reference Manual')
dcee403d 235.PP
91d7df00
KM
236Each command is typed on a line by itself, and may take arguments
237following the command word. The command need not be typed in its
238entirety \- the first command which matches the typed prefix is used.
dcee403d 239For commands which take message lists as arguments, if no message
91d7df00
KM
240list is given, then the next message forward which satisfies the
241command's requirements is used. If there are no messages forward of
242the current message, the search proceeds backwards, and if there are no
243good messages at all,
244.I mail
245types ``No applicable messages'' and
246aborts the command.
247.TP 12n
248.B \-
249Goes to the previous message and prints it out. If given a numeric
250argument
dcee403d 251.IR n ,
91d7df00 252goes to the
dcee403d 253.IR n -th
91d7df00
KM
254previous message and prints it.
255.TP
256.B ?
257Prints a brief summary of commands.
258.TP
259.B !
260Executes the \s-2UNIX\s0 shell command which follows.
261.TP
dcee403d
KM
262.B Print
263(\fBP\fR)
264Like
265.B print
266but also prints out ignored header fields. See also
267.B print
bb04cec6
KM
268,
269.B ignore
dcee403d 270and
bb04cec6 271.B retain.
dcee403d
KM
272.TP
273.B Reply
e7dd39cf 274(\fBR\fR)
dcee403d
KM
275Reply to originator. Does not reply to other
276recipients of the original message.
277.TP
278.B Type
e7dd39cf 279(\fBT\fR)
dcee403d
KM
280Identical to the
281.B Print
282command.
283.TP
91d7df00
KM
284.B alias
285(\fBa\fR) With no arguments, prints out all currently-defined aliases. With one
dcee403d
KM
286argument, prints out that alias. With more than one argument, creates
287an new or changes an on old alias.
288.TP
289.B alternates
290(\fBalt\fR)
291The
292.B alternates
293command is useful if you have accounts on several machines.
294It can be used to inform
295.I mail
296that the listed addresses are really you. When you
297.B reply
298to messages,
299.I mail
300will not send a copy of the message to any of the addresses
301listed on the
302.I alternates
303list. If the
304.B alternates
305command is given with no argument, the current set of alternate
306names is displayed.
91d7df00
KM
307.TP
308.B chdir
309(\fBc\fR) Changes the user's working directory to that specified, if given. If
310no directory is given, then changes to the user's login directory.
311.TP
dcee403d
KM
312.B copy
313(\fBco\fR)
314The
315.B copy
316command does the same thing that
317.B save
318does, except that it does not mark the messages it
319is used on for deletion when you quit.
320.TP
91d7df00
KM
321.B delete
322(\fBd\fR) Takes a list of messages as argument and marks them all as deleted.
323Deleted messages will not be saved in
dcee403d 324.IR mbox ,
91d7df00
KM
325nor will they be available for most other commands.
326.TP
327.B dp
328(also \fBdt\fR) Deletes the current message and prints the next message.
329If there is no next message,
330.I mail
331says ``at EOF.''
332.TP
333.B edit
334(\fBe\fR) Takes a list of messages and points the text editor at each one in
335turn. On return from the editor, the message is read back in.
336.TP
337.B exit
338(\fBex\fR or \fBx\fR) Effects an immediate return to the Shell without
339modifying the user's system mailbox, his
340.I mbox
341file, or his edit file in
dcee403d
KM
342.BR \-f .
343.TP
344.B file
345(\fBfi\fR)
346The same as
347.BR folder .
348.TP
349.B folders
350List the names of the folders in your folder directory.
351.TP
352.B folder
353(\fBfo\fR)
354The
355.B folder
356command switches to a new mail file or folder. With no
357arguments, it tells you which file you are currently reading.
358If you give it an argument, it will write out changes (such
359as deletions) you have made in the current file and read in
360the new file. Some special conventions are recognized for
361the name. # means the previous file, % means your system
362mailbox, %user means user's system mailbox, & means
363your \~/mbox file, and +folder means a file in your folder
364directory.
91d7df00
KM
365.TP
366.B from
367(\fBf\fR) Takes a list of messages and prints their message headers.
368.TP
369.B headers
370(\fBh\fR) Lists the current range of headers, which is an 18 message group. If
371a ``+'' argument is given, then the next 18 message group is printed, and if
372a ``\-'' argument is given, the previous 18 message group is printed.
373.TP
374.B help
375A synonym for ?
376.TP
377.B hold
378(\fBho\fR, also \fBpreserve\fR) Takes a message list and marks each
379message therein to be saved in the
380user's system mailbox instead of in
dcee403d 381.IR mbox .
91d7df00
KM
382Does not override the
383.B delete
384command.
385.TP
dcee403d 386.B ignore
bb04cec6
KM
387.B N.B.:
388.I Ignore
389has been superseded by
390.I retain.
391.br
dcee403d
KM
392Add the list of header fields named to the
393.IR "ignored list" .
394Header fields in the ignore list are not printed
395on your terminal when you print a message. This
396command is very handy for suppression of certain machine-generated
397header fields. The
398.B Type
399and
400.B Print
401commands can be used to print a message in its entirety, including
402ignored fields. If
403.B ignore
404is executed with no arguments, it lists the current set of
405ignored fields.
406.TP
91d7df00
KM
407.B mail
408(\fBm\fR) Takes as argument login names and distribution group names and sends
409mail to those people.
410.TP
dcee403d
KM
411.B mbox
412Indicate that a list of messages be sent to
413.I mbox
414in your home directory when you quit. This is the default
415action for messages if you do
416.I not
417have the
418.I hold
419option set.
420.TP
91d7df00
KM
421.B next
422(\fBn\fR like \fB+\fR or CR) Goes to the next message in sequence and types it.
423With an argument list, types the next matching message.
424.TP
425.B preserve
dcee403d 426(\fBpre\fR)
91d7df00 427A synonym for
dcee403d 428.BR hold .
91d7df00
KM
429.TP
430.B print
dcee403d
KM
431(\fBp\fR)
432Takes a message list and types out each message on the user's terminal.
91d7df00
KM
433.TP
434.B quit
435(\fBq\fR) Terminates the session, saving all undeleted, unsaved messages in
436the user's
437.I mbox
438file in his login directory, preserving all messages marked with
439.B hold
440or
441.B preserve
442or never referenced
443in his system mailbox, and removing all other messages from his system
444mailbox. If new mail has arrived during the session, the message
445``You have new mail'' is given. If given while editing a
446mailbox file with the
447.B \-f
448flag, then the edit file is rewritten. A return to the Shell is
449effected, unless the rewrite of edit file fails, in which case the user
450can escape with the
451.B exit
452command.
453.TP
454.B reply
dcee403d
KM
455(\fBr\fR)
456Takes a message list and sends mail to the sender and all
457recipients of the specified message.
458The default message must not be deleted.
91d7df00
KM
459.TP
460.B respond
461A synonym for
dcee403d 462.BR reply .
91d7df00 463.TP
bb04cec6
KM
464.B retain
465Add the list of header fields named to the
466.IR "retained list" .
467Only the header fields in the retain list
468are shown on your terminal when you print a message.
469All other header fields are suppressed.
470The
471.B Type
472and
473.B Print
474commands can be used to print a message in its entirety.
475If
476.B retain
477is executed with no arguments, it lists the current set of
478retained fields.
479.TP
91d7df00
KM
480.B save
481(\fBs\fR) Takes a message list and a filename and appends each message in
482turn to the end of the file. The filename in quotes, followed by the line
483count and character count is echoed on the user's terminal.
484.TP
485.B set
486(\fBse\fR) With no arguments, prints all variable values. Otherwise, sets
487option. Arguments are of the form
488``option=value''
bb04cec6 489(no space before or after =) or
91d7df00
KM
490``option.''
491.TP
492.B shell
493(\fBsh\fR) Invokes an interactive version of the shell.
494.TP
495.B size
496Takes a message list and prints out the size in characters of each
497message.
498.TP
dcee403d
KM
499.B source
500(\fBso\fR)
501The
502.B source
503command reads
504.I mail
505commands from a file.
506.TP
91d7df00
KM
507.B top
508Takes a message list and prints the top few lines of each. The number of
509lines printed is controlled by the variable
510.B toplines
511and defaults to five.
512.TP
513.B type
514(\fBt\fR) A synonym for
dcee403d 515.BR print .
91d7df00
KM
516.TP
517.B unalias
518Takes a list of names defined by
519.B alias
520commands and discards the remembered groups of users. The group names
521no longer have any significance.
522.TP
523.B undelete
634278dc 524(\fBu\fR) Takes a message list and marks each message as
91d7df00
KM
525.I not
526being deleted.
527.TP
634278dc
S
528.B unread
529(\fBU\fR) Takes a message list and marks each message as
530.I not
531having been read.
532.TP
91d7df00
KM
533.B unset
534Takes a list of option names and discards their remembered values;
535the inverse of
dcee403d 536.BR set .
91d7df00
KM
537.TP
538.B visual
539(\fBv\fR) Takes a message list and invokes the display editor on each message.
540.TP
541.B write
b3f2d791
S
542(\fBw\fR) Similar to
543.BR save ,
544except that
545.I only
546the message body (\fIwithout\fP the header) is saved.
547Extremely useful for such tasks as sending and receiving source
548program text over the message system.
91d7df00
KM
549.TP
550.B xit
551(\fBx\fR) A synonym for
dcee403d
KM
552.BR exit .
553.TP
554.B z
555.I Mail
556presents message headers in windowfuls as described under the
557.B headers
558command. You can move
559.IR mail 's
560attention forward to the next window with the
561.B z
562command. Also, you can move to the previous window by using
563.BR z\- .
91d7df00
KM
564.PP
565Here is a summary of the tilde escapes,
566which are used when composing messages to perform
567special functions. Tilde escapes are only recognized at the beginning
568of lines. The name
569``tilde\ escape''
570is somewhat of a misnomer since the actual escape character can be set
571by the option
572.B escape.
573.TP 12n
dcee403d 574.BR ~! command
91d7df00
KM
575Execute the indicated shell command, then return to the message.
576.TP
cb530a2d
KM
577\fB~b\fR name ...
578Add the given names to the list of carbon copy recipients but do not make
579the names visible in the Cc: line ("blind" carbon copy).
580.TP
91d7df00
KM
581\fB~c\fR name ...
582Add the given names to the list of carbon copy recipients.
583.TP
584.B ~d
585Read the file ``dead.letter'' from your home directory into the message.
586.TP
587.B ~e
588Invoke the text editor on the message collected so far. After the
589editing session is finished, you may continue appending text to the
590message.
591.TP
dcee403d
KM
592\fB~f\fR messages
593Read the named messages into the message being sent.
594If no messages are specified, read in the current message.
595.TP
91d7df00
KM
596.B ~h
597Edit the message header fields by typing each one in turn and allowing
598the user to append text to the end or modify the field by using the
599current terminal erase and kill characters.
600.TP
601\fB~m\fR messages
602Read the named messages into the message being sent, shifted right one
603tab. If no messages are specified, read the current message.
604.TP
605.B ~p
606Print out the message collected so far, prefaced by the message header
607fields.
608.TP
609.B ~q
610Abort the message being sent, copying the message to
611``dead.letter''
612in your home directory if
613.B save
614is set.
615.TP
616\fB~r\fR filename
617Read the named file into the message.
618.TP
619\fB~s\fR string
620Cause the named string to become the current subject field.
621.TP
622\fB~t\fR name ...
623Add the given names to the direct recipient list.
624.TP
625.B ~v
626Invoke an alternate editor (defined by the VISUAL option) on the
627message collected so far. Usually, the alternate editor will be a
628screen editor. After you quit the editor, you may resume appending
629text to the end of your message.
630.TP
631\fB~w\fR filename
632Write the message onto the named file.
633.TP
634\fB~\||\|\fRcommand
635Pipe the message through the command as a filter. If the command gives
636no output or terminates abnormally, retain the original text of the
637message. The command
638.IR fmt (1)
639is often used as
640.I command
641to rejustify the message.
642.TP
dcee403d 643.BR ~~ string
91d7df00
KM
644Insert the string of text in the message prefaced by a single ~. If
645you have changed the escape character, then you should double
646that character in order to send it.
647.PP
648Options are controlled via the
649.B set
650and
651.B unset
652commands. Options may be either binary, in which case it is only
bfe02f44 653significant to see whether they are set or not; or string, in which
91d7df00
KM
654case the actual value is of interest.
655The binary options include the following:
656.TP 15n
657.B append
658Causes messages saved in
659.I mbox
660to be appended to the end rather than prepended.
661(This is set in
662/usr/lib/Mail.rc
663on version 7 systems.)
664.TP
665.B ask
666Causes
667.I mail
668to prompt you for the subject of each message you send. If
669you respond with simply a newline, no subject field will be sent.
670.TP
671.B askcc
672Causes you to be prompted for additional carbon copy recipients at the
673end of each message. Responding with a newline indicates your
674satisfaction with the current list.
675.TP
676.B autoprint
677Causes the
678.B delete
679command to behave like
680.B dp
681\- thus, after deleting a message, the next one will be typed
682automatically.
683.TP
dcee403d
KM
684.B debug
685Setting the binary option
686.I debug
687is the same as specifying
688.B \-d
689on the command line and causes
690.I mail
691to output all sorts of information useful for debugging
692.IR mail .
693.TP
694.B dot
695The binary option
696.I dot
697causes
698.I mail
699to interpret a period alone on a line as the terminator
700of a message you are sending.
701.TP
702.B hold
703This option is used to hold messages in the system mailbox
704by default.
705.TP
91d7df00
KM
706.B ignore
707Causes interrupt signals from your terminal to be ignored and echoed as
708@'s.
709.TP
dcee403d
KM
710.B ignoreeof
711An option related to
712.I dot
713is
714.I ignoreeof
715which makes
716.I mail
717refuse to accept a control-d as the end of a message.
718.I Ignoreeof
719also applies to
720.I mail
721command mode.
722.TP
91d7df00
KM
723.B metoo
724Usually, when a group is expanded that contains the sender, the sender
725is removed from the expansion. Setting this option causes the sender
726to be included in the group.
727.TP
dcee403d
KM
728.B nosave
729Normally, when you abort a message with two \s-2RUBOUT\s0,
730.I mail
731copies the partial letter to the file ``dead.letter''
732in your home directory. Setting the binary option
733.I nosave
734prevents this.
735.TP
634278dc
S
736.B Replyall
737Reverses the sense of
738.I reply
739and
740.I Reply
741commands.
742.TP
91d7df00
KM
743.B quiet
744Suppresses the printing of the version when first invoked.
745.TP
dcee403d
KM
746.B verbose
747Setting the option
748.I verbose
749is the same as using the
750.B \-v
751flag on the command line. When mail runs in verbose mode,
752the actual delivery of messages is displayed on he users
753terminal.
91d7df00
KM
754.PP
755The following options have string values:
756.TP 15n
757EDITOR
758Pathname of the text editor to use in the
759.B edit
760command and ~e escape. If not defined, then a default editor is used.
761.TP
634278dc
S
762PAGER
763Pathname of the program to use in the
764.B more
765command or when
766.I crt
767variable is set. A default paginator is used if this option is
768not defined.
769.TP
91d7df00
KM
770SHELL
771Pathname of the shell to use in the
772.B !
773command and the ~! escape. A default shell is used if this option is
774not defined.
775.TP
776VISUAL
777Pathname of the text editor to use in the
778.B visual
779command and ~v escape.
780.TP
dcee403d
KM
781.B crt
782The valued option
783.I crt
784is used as a threshold to determine how long a message must
785be before
634278dc 786.B PAGER
dcee403d
KM
787is used to read it.
788.TP
91d7df00
KM
789.B escape
790If defined, the first character of this option gives the character to
791use in the place of ~ to denote escapes.
792.TP
dcee403d
KM
793.B folder
794The name of the directory to use for storing folders of
795messages. If this name begins with a `/',
796.I mail
797considers it to be an absolute pathname; otherwise, the
798folder directory is found relative to your home directory.
799.TP
91d7df00
KM
800.B record
801If defined, gives the pathname of the file used to record all outgoing
802mail. If not defined, then outgoing mail is not so saved.
803.TP
804.B toplines
805If defined, gives the number of lines of a message to be printed out
806with the
807.B top
808command; normally, the first five lines are printed.
809.SH FILES
810.if n .ta 2.5i
811.if t .ta 1.8i
812/usr/spool/mail/* post office
813.br
814~/mbox your old mail
815.br
816~/.mailrc file giving initial mail commands
817.br
818/tmp/R# temporary for editor escape
819.br
820/usr/lib/Mail.help* help files
821.br
822/usr/lib/Mail.rc system initialization file
823.br
dcee403d 824Message* temporary for editing messages
91d7df00 825.SH "SEE ALSO"
dcee403d
KM
826binmail(1), fmt(1), newaliases(1), aliases(5),
827.br
828mailaddr(7), sendmail(8)
91d7df00
KM
829.br
830`The Mail Reference Manual'
dcee403d
KM
831.SH BUGS
832There are many flags that are not documented here. Most are
833not useful to the general user.
834.br
835Usually,
836.I mail
837is just a link to
838.IR Mail ,
839which can be confusing.
91d7df00
KM
840.SH AUTHOR
841Kurt Shoens