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