BSD 4_1c_2 release
[unix-history] / usr / doc / Mail / mail5.nr
CommitLineData
1c36befc
C
1.bp
2.sh 1 "Additional features"
3.pp
4This section describes some additional commands of use for
5reading your mail, setting options, and handling lists of messages.
6.sh 2 "Message lists"
7.pp
8Several
9.i Mail
10commands accept a list of messages as an argument.
11Along with
12.b type
13and
14.b delete ,
15described in section 2,
16there is the
17.b from
18command, which prints the message headers associated with the
19message list passed to it.
20The
21.b from
22command is particularly useful in conjunction with some of the
23message list features described below.
24.pp
25A
26.i "message list"
27consists of a list of message numbers, ranges, and names,
28separated by spaces or tabs. Message numbers may be either
29decimal numbers, which directly specify messages, or one of the
30special characters
31.q \(ua
32.q "."
33or
34.q "$"
35to specify the first relevant, current, or last
36relevant message, respectively.
37.i Relevant
38here means, for most commands
39.q "not deleted"
40and
41.q "deleted"
42for the
43.b undelete
44command.
45.pp
46A range of messages consists of two message numbers (of the form
47described in the previous paragraph) separated by a dash.
48Thus, to print the first four messages, use
49.(l
50type 1\-4
51.)l
52and to print all the messages from the current message to the last
53message, use
54.(l
55type .\-$
56.)l
57.pp
58A
59.i name
60is a user name. The user names given in the message list are
61collected together and each message selected by other means
62is checked to make sure it was sent by one of the named users.
63If the message consists entirely of user names, then every
64message sent by one those users that is
65.i relevant
66(in the sense described earlier)
67is selected. Thus, to print every message sent to you by
68.q root,
69do
70.(l
71type root
72.)l
73.pp
74As a shorthand notation, you can specify simply
75.q *
76to get every
77.i relevant
78(same sense)
79message. Thus,
80.(l
81type *
82.)l
83prints all undeleted messages,
84.(l
85delete *
86.)l
87deletes all undeleted messages, and
88.(l
89undelete *
90.)l
91undeletes all deleted messages.
92.pp
93You can search for the presence of a word in subject lines with
94.b / .
95For example, to print the headers of all messages that contain the
96word
97.q PASCAL,
98do:
99.(l
100from /pascal
101.)l
102Note that subject searching ignores upper/lower case differences.
103.sh 2 "List of commands"
104.pp
105This section describes all the
106.i Mail
107commands available when
108receiving mail.
109.ip \fB!\fP
110Used to preface a command to be executed by the shell.
111.ip \fB\-\fP
112The
113.rb \-
114command goes to the previous message and prints it. The
115.rb \-
116command may be given a decimal number
117.i n
118as an argument, in which case the
119.i n th
120previous message is gone to and printed.
121.ip \fBPrint\fP
122Like
123.b print ,
124but also print out ignored header fields. See also
125.b print
126and
127.b ignore .
128.ip \fBReply\fP
129Note the capital R in the name.
130Frame a reply to a one or more messages.
131The reply (or replies if you are using this on multiple messages)
132will be sent ONLY to the person who sent you the message
133(respectively, the set of people who sent the messages you are
134replying to).
135You can
136add people using the
137.b ~t
138and
139.b ~c
140tilde escapes. The subject in your reply is formed by prefacing the
141subject in the original message with
142.q "Re:"
143unless it already began thus.
144If the original message included a
145.q "reply-to"
146header field, the reply will go
147.i only
148to the recipient named by
149.q "reply-to."
150You type in your message using the same conventions available to you
151through the
152.b mail
153command.
154The
155.b Reply
156command is especially useful for replying to messages that were sent
157to enormous distribution groups when you really just want to
158send a message to the originator. Use it often.
159.ip \fBType\fP
160Identical to the
161.b Print
162command.
163.ip \fBalias\fP
164Define a name to stand for a set of other names.
165This is used when you want to send messages to a certain
166group of people and want to avoid retyping their names.
167For example
168.(l
169alias project john sue willie kathryn
170.)l
171creates an alias
172.i project
173which expands to the four people John, Sue, Willie, and Kathryn.
174.ip \fBalternates\fP
175If you have accounts on several machines, you may find it convenient
176to use the /usr/lib/aliases on all the machines except one to direct
177your mail to a single account.
178The
179.b alternates
180command is used to inform
181.i Mail
182that each of these other addresses is really
183.i you .
184.i Alternates
185takes a list of user names and remembers that they are all actually you.
186When you
187.b reply
188to messages that were sent to one of these alternate names,
189.i Mail
190will not bother to send a copy of the message to this other address (which
191would simply be directed back to you by the alias mechanism).
192If
193.i alternates
194is given no argument, it lists the current set of alternate names.
195.b Alternates
196is usually used in the .mailrc file.
197.ip \fBchdir\fP
198The
199.b chdir
200command allows you to change your current directory.
201.b Chdir
202takes a single argument, which is taken to be the pathname of
203the directory to change to. If no argument is given,
204.b chdir
205changes to your home directory.
206.ip \fBcopy\fP
207The
208.b copy
209command does the same thing that
210.b save
211does, except that it does not mark the messages it is used on
212for deletion when you quit.
213.ip \fBdelete\fP
214Deletes a list of messages. Deleted messages can be reclaimed
215with the
216.b undelete
217command.
218.ip \fBdt\fP
219The
220.b dt
221command deletes the current message and prints the next message.
222It is useful for quickly reading and disposing of mail.
223.ip \fBedit\fP
224To edit individual messages using the text editor, the
225.b edit
226command is provided. The
227.b edit
228command takes a list of messages as described under the
229.b type
230command and processes each by writing it into the file
231Message\c
232.i x
233where
234.i x
235is the message number being edited and executing the text editor on it.
236When you have edited the message to your satisfaction, write the message
237out and quit, upon which
238.i Mail
239will read the message back and remove the file.
240.b Edit
241may be abbreviated to
242.b e .
243.ip \fBelse\fP
244Marks the end of the then-part of an
245.b if
246statement and the beginning of the
247part to take effect if the condition of the
248.b if
249statement is false.
250.ip \fBendif\fP
251Marks the end of an
252.b if
253statement.
254.ip \fBexit\fP
255Leave
256.i Mail
257without updating the system mailbox or the file your were reading.
258Thus, if you accidentally delete several messages, you can use
259.b exit
260to avoid scrambling your mailbox.
261.ip \fBfile\fP
262The same as
263.b folder .
264.ip \fBfolders\fP
265List the names of the folders in your folder directory.
266.ip \fBfolder\fP
267The
268.b folder
269command switches to a new mail file or folder. With no arguments, it
270tells you which file you are currently reading. If you give
271it an argument, it will write out changes (such as deletions)
272you have made in the current file and read the new file.
273Some special conventions are recognized for the name:
274.(b
275.TS
276center;
277c c
278l a.
279Name Meaning
280_
281# Previous file read
282% Your system mailbox
283%name \fIName\fP's system mailbox
284& Your ~/mbox file
285+folder A file in your folder directory
286.TE
287.)b
288.ip \fBfrom\fP
289The
290.b from
291command takes a list of messages and prints out the header lines for each one;
292hence
293.(l
294from joe
295.)l
296is the easy way to display all the message headers from \*(lqjoe.\*(rq
297.ip \fBheaders\fP
298When you start up
299.i Mail
300to read your mail, it lists the message headers that you have.
301These headers tell you who each message is from, when they were
302sent, how many lines and characters each message is, and the
303.q "Subject:"
304header field of each message, if present. In addition,
305.i Mail
306tags the message header of each message that has been the object
307of the
308.b preserve
309command with a
310.q P.
311Messages that have been
312.b saved
313or
314.b written
315are flagged with a
316.q *.
317Finally,
318.b deleted
319messages are not printed at all. If you wish to reprint the current
320list of message headers, you can do so with the
321.b headers
322command. The
323.b headers
324command (and thus the initial header listing)
325only lists the first so many message headers.
326The number of headers listed depends on the speed of your
327terminal.
328This can be overridden by specifying the number of headers you
329want with the
330.i window
331option.
332.i Mail
333maintains a notion of the current
334.q window
335into your messages for the purposes of printing headers.
336Use the
337.b z
338command to move forward and back a window.
339You can move
340.i Mail's
341notion of the current window directly to a particular message by
342using, for example,
343.(l
344headers 40
345.)l
346to move
347.i Mail's
348attention to the messages around message 40. The
349.b headers
350command can be abbreviated to
351.b h .
352.ip \fBhelp\fP
353Print a brief and usually out of date help message about the commands
354in
355.i Mail .
356Refer to this manual instead.
357.ip \fBhold\fP
358Arrange to hold a list of messages in the system mailbox, instead
359of moving them to the file
360.i mbox
361in your home directory. If you set the binary option
362.i hold ,
363this will happen by default.
364.ip \fBif\fP
365Commands in your
366.q .mailrc
367file can be executed conditionally depending on whether you are
368sending or receiving mail with the
369.b if
370command. For example, you can do:
371.(l
372if receive
373 \fIcommands\fP...
374endif
375.)l
376An
377.b else
378form is also available:
379.(l
380if send
381 \fIcommands\fP...
382else
383 \fIcommands\fP...
384endif
385.)l
386Note that the only allowed conditions are
387.b receive
388and
389.b send .
390.ip \fBignore\fP
391Add the list of header fields named to the
392.i "ignore list" .
393Header fields in the ignore list are not printed on your
394terminal when you print a message. This allows you to suppress
395printing of certain machine-generated header fields, such as
396.i Via
397which are not usually of interest. The
398.b Type
399and
400.b Print
401commands can be used to print a message in its entirety, including
402ignored fields.
403If
404.b ignore
405is executed with no arguments, it lists the current set of ignored fields.
406.ip \fBmail\fP
407Send mail to one or more people. If you have the
408.i ask
409option set,
410.i Mail
411will prompt you for a subject to your message. Then you
412can type in your message, using tilde escapes as described in
413section 4 to edit, print, or modify your message. To signal your
414satisfaction with the message and send it, type control-d at the
415beginning of a line, or a . alone on a line if you set the option
416.i dot .
417To abort the message, type two interrupt characters (\s-2RUBOUT\s0
418by default) in a row or use the
419.b ~q
420escape.
421.ip \fBmbox\fP
422Indicate that a list of messages be sent to
423.i mbox
424in your home directory when you quit. This is the default
425action for messages if you do
426.i not
427have the
428.i hold
429option set.
430.ip \fBnext\fP
431The
432.b next
433command goes to the next message and types it. If given a message list,
434.b next
435goes to the first such message and types it. Thus,
436.(l
437next root
438.)l
439goes to the next message sent by
440.q root
441and types it. The
442.b next
443command can be abbreviated to simply a newline, which means that one
444can go to and type a message by simply giving its message number or
445one of the magic characters
446.q "\(ua"
447.q "."
448or
449.q "$".
450Thus,
451.(l
452\&.
453.)l
454prints the current message and
455.(l
4564
457.)l
458prints message 4, as described previously.
459.ip \fBpreserve\fP
460Same as
461.b hold .
462Cause a list of messages to be held in your system mailbox when you quit.
463.ip \fBquit\fP
464Leave
465.i Mail
466and update the file, folder, or system mailbox your were reading.
467Messages that you have examined are marked as
468.q read
469and messages that existed when you started are marked as
470.q old.
471If you were editing your system mailbox and
472if you have set the binary option
473.i hold ,
474all messages which have not been deleted, saved, or mboxed
475will be retained in your system mailbox.
476If you were editing your system mailbox and
477you did
478.i not
479have
480.i hold
481set, all messages which have not been deleted, saved, or preserved
482will be moved to the file
483.i mbox
484in your home directory.
485.ip \fBreply\fP
486Frame a reply to a single message.
487The reply will be sent to the
488person who sent you the message to which you are replying, plus all
489the people who received the original message, except you. You can
490add people using the
491.b ~t
492and
493.b ~c
494tilde escapes. The subject in your reply is formed by prefacing the
495subject in the original message with
496.q "Re:"
497unless it already began thus.
498If the original message included a
499.q "reply-to"
500header field, the reply will go
501.i only
502to the recipient named by
503.q "reply-to."
504You type in your message using the same conventions available to you
505through the
506.b mail
507command.
508.ip \fBsave\fP
509It is often useful to be able to save messages on related topics
510in a file. The
511.b save
512command gives you ability to do this. The
513.b save
514command takes as argument a lit of message numbers, followed by
515the name of the file on which to save the messages. The messages
516are appended to the named file, thus allowing one to keep several
517messages in the file, stored in the order they were put there.
518The
519.b save
520command can be abbreviated to
521.b s .
522An example of the
523.b save
524command relative to our running example is:
525.(l
526s 1 2 tuitionmail
527.)l
528.b Saved
529messages are not automatically saved in
530.i mbox
531at quit time, nor are they selected by the
532.b next
533command described above, unless explicitly specified.
534.ip \fBset\fP
535Set an option or give an option a value. Used to customize
536.i Mail .
537Section 5.3 contains a list of the options. Options can be
538.i binary ,
539in which case they are
540.i on
541or
542.i off ,
543or
544.i valued .
545To set a binary option
546.i option
547.i on ,
548do
549.(l
550set option
551.)l
552To give the valued option
553.i option
554the value
555.i value ,
556do
557.(l
558set option=value
559.)l
560Several options can be specified in a single
561.b set
562command.
563.ip \fBshell\fP
564The
565.b shell
566command allows you to
567escape to the shell.
568.b Shell
569invokes an interactive shell and allows you to type commands to it.
570When you leave the shell, you will return to
571.i Mail .
572The shell used is a default assumed by
573.i Mail ;
574you can override this default by setting the valued option
575.q SHELL,
576eg:
577.(l
578set SHELL=/bin/csh
579.)l
580.ip \fBsource\fP
581The
582.b source
583command reads
584.i Mail
585commands from a file. It is useful when you are trying to fix your
586.q .mailrc
587file and you need to re-read it.
588.ip \fBtop\fP
589The
590.b top
591command takes a message list and prints the first five lines
592of each addressed message. It may be abbreviated to
593.b to .
594If you wish, you can change the number of lines that
595.b top
596prints out by setting the valued option
597.q "toplines."
598On a CRT terminal,
599.(l
600set toplines=10
601.)l
602might be preferred.
603.ip \fBtype\fP
604Print a list of messages on your terminal. If you have set the
605option
606.i crt
607to a number and the total number of lines in the messages you are
608printing exceed that specified by
609.i crt ,
610the messages will be printed by a terminal paging program such as
611.i more .
612.ip \fBundelete\fP
613The
614.b undelete
615command causes a message that had been deleted previously to regain
616its initial status. Only messages that have been deleted may be
617undeleted. This command may be abbreviated to
618.b u .
619.ip \fBunset\fP
620Reverse the action of setting a binary or valued option.
621.ip \fBvisual\fP
622It is often useful to be able to invoke one of two editors,
623based on the type of terminal one is using. To invoke
624a display oriented editor, you can use the
625.b visual
626command. The operation of the
627.b visual
628command is otherwise identical to that of the
629.b edit
630command.
631.ne 2v+\n(psu
632.sp \n(psu
633Both the
634.b edit
635and
636.b visual
637commands assume some default text editors. These default editors
638can be overridden by the valued options
639.q EDITOR
640and
641.q VISUAL
642for the standard and screen editors. You might want to do:
643.(l
644set EDITOR=/usr/ucb/ex VISUAL=/usr/ucb/vi
645.)l
646.ip \fBwrite\fP
647The
648.b save
649command always writes the entire message, including the headers,
650into the file. If you want to write just the message itself, you
651can use the
652.b write
653command. The
654.b write
655command has the same syntax as the
656.b save
657command, and can be abbreviated to simply
658.b w .
659Thus, we could write the second message by doing:
660.(l
661w 2 file.c
662.)l
663As suggested by this example, the
664.b write
665command is useful for such tasks as sending and receiving
666source program text over the message system.
667.ip \fBz\fP
668.i Mail
669presents message headers in windowfuls as described under
670the
671.b headers
672command.
673You can move
674.i Mail's
675attention forward to the next window by giving the
676.(l
677z+
678.)l
679command. Analogously, you can move to the previous window with:
680.(l
681z\-
682.)l
683.sh 2 "Custom options"
684.pp
685Throughout this manual, we have seen examples of binary and valued options.
686This section describes each of the options in alphabetical order, including
687some that you have not seen yet.
688To avoid confusion, please note that the options are either
689all lower case letters or all upper case letters. When I start a sentence
690such as:
691.q "Ask"
692causes
693.i Mail
694to prompt you for a subject header,
695I am only capitalizing
696.q ask
697as a courtesy to English.
698.ip \fBEDITOR\fP
699The valued option
700.q EDITOR
701defines the pathname of the text editor to be used in the
702.b edit
703command and ~e. If not defined, a standard editor is used.
704.ip \fBSHELL\fP
705The valued option
706.q SHELL
707gives the path name of your shell. This shell is used for the
708.b !
709command and ~! escape. In addition, this shell expands
710file names with shell metacharacters like * and ? in them.
711.ip \fBVISUAL\fP
712The valued option
713.q VISUAL
714defines the pathname of your screen editor for use in the
715.b visual
716command
717and ~v escape. A standard screen editor is used if you do not define one.
718.ip \fBappend\fP
719The
720.q append
721option is binary and
722causes messages saved in
723.i mbox
724to be appended to the end rather than prepended.
725Normally,
726.i Mail will put messages in
727.i mbox
728in the same order that the system puts messages in your system mailbox.
729By setting
730.q append,
731you are requesting that
732.i mbox
733be appended to regardless. It is in any event quicker to append.
734.ip \fBask\fP
735.q "Ask"
736is a binary option which
737causes
738.i Mail
739to prompt you for the subject of each message you send.
740If you respond with simply a newline, no subject field will be sent.
741.ip \fBaskcc\fP
742.q Askcc
743is a binary option which
744causes you to be prompted for additional carbon copy recipients at the
745end of each message. Responding with a newline shows your
746satisfaction with the current list.
747.ip \fBautoprint\fP
748.q Autoprint
749is a binary option which
750causes the
751.b delete
752command to behave like
753.b dp
754\*- thus, after deleting a message, the next one will be typed
755automatically. This is useful to quickly scanning and deleting
756messages in your mailbox.
757.ip \fBdot\fP
758.q Dot
759is a binary option which, if set, causes
760.i Mail
761to interpret a period alone on a line as the terminator
762of a message you are sending.
763.ip \fBescape\fP
764To allow you to change the escape character used when sending
765mail, you can set the valued option
766.q escape.
767Only the first character of the
768.q escape
769option is used, and it must be doubled if it is to appear as
770the first character of a line of your message. If you change your escape
771character, then ~ loses all its special meaning, and need no longer be doubled
772at the beginning of a line.
773.ip \fBfolder\fP
774The name of the directory to use for storing folders of messages.
775If this name begins with a `/'
776.i Mail
777considers it to be an absolute pathname; otherwise, the folder directory
778is found relative to your home directory.
779.ip \fBignore\fP
780The binary option
781.q ignore
782causes \s-2RUBOUT\s0 characters from your terminal to be ignored and echoed
783as @'s while you are sending mail. \s-2RUBOUT\s0 characters retain their
784original meaning in
785.i Mail
786command mode.
787Setting the
788.q ignore
789option is equivalent to supplying the
790.b \-i
791flag on the command line as described in section 2.
792.ip \fBignoreeof\fP
793An option related to
794.q dot
795is
796.q ignoreeof
797which makes
798.i Mail
799refuse to accept a control\-d as the end of a message.
800.q Ignoreeof
801also applies to
802.i Mail
803command mode.
804.ip \fBkeep\fP
805The
806.q keep
807option causes
808.i Mail
809to truncate your system mailbox instead of deleting it when it
810is empty. This is useful if you elect to protect your mailbox, which
811you would do with the shell command:
812.(l
813chmod 600 /usr/spool/mail/yourname
814.)l
815where
816.i yourname
817is your login name. If you do not do this, anyone can probably read
818your mail, although people usually don't.
819.ip \fBkeepsave\fP
820When you
821.b save
822a message,
823.i Mail
824usually discards it when you
825.b quit .
826To retain all saved messages, set the
827.q keepsave
828option.
829.ip \fBmetoo\fP
830When sending mail to an alias,
831.i Mail
832makes sure that if you are included in the alias, that mail will not
833be sent to you. This is useful if a single alias is being used by
834all members of the group. If however, you wish to receive a copy of
835all the messages you send to the alias, you can set the binary option
836.q metoo.
837.ip \fBnosave\fP
838Normally,
839when you abort a message with two \s-2RUBOUTs\s0,
840.i Mail
841copies the partial letter to the file
842.q dead.letter
843in your home directory. Setting the binary option
844.q nosave
845prevents this.
846.ip \fBquiet\fP
847The binary option
848.q quiet
849suppresses the printing of the version when
850.i Mail
851is first invoked,
852as well as printing the for example
853.q "Message 4:"
854from the
855.b type
856command.
857.ip \fBrecord\fP
858If you love to keep records, then the
859valued option
860.q record
861can be set to the name of a file to save your outgoing mail.
862Each new message you send is appended to the end of the file.
863.ip \fBscreen\fP
864When
865.i Mail
866initially prints the message headers, it determines the number to
867print by looking at the speed of your terminal. The faster your
868terminal, the more it prints.
869The valued option
870.q screen
871overrides this calculation and
872specifies how many message headers you want printed.
873This number is also used for scrolling with the
874.b z
875command.
876.ip \fBsendmail\fP
877To alternate delivery system, set the
878.q sendmail
879option to the full pathname of the program to use. Note: this is not
880for everyone! Most people should use the default delivery system.
881.ip \fBtoplines\fP
882The valued option
883.q toplines
884defines the number of lines that the
885.q top
886command will print out instead of the default five lines.