BSD 4_3_Net_2 release
[unix-history] / usr / src / share / doc / usd / 07.Mail / mail2.nr
CommitLineData
ff262511
KB
1.\" Copyright (c) 1980 The Regents of the University of California.
2.\" All rights reserved.
f320d7c6 3.\"
af359dea
C
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\" must display the following acknowledgement:
14.\" This product includes software developed by the University of
15.\" California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
ff262511 19.\"
af359dea
C
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)mail2.nr 6.3 (Berkeley) 4/17/91
f320d7c6 33.\"
0d192f4a
KD
34.bp
35.sh 1 "Common usage"
36.pp
37The
38.i Mail
39command has two distinct usages, according to whether one
40wants to send or receive mail. Sending mail is simple: to send a
41message to a user whose login name is, say,
42\*(lqroot,\*(rq
43use the shell
44command:
45.(l
46% Mail root
47.)l
48then type your message. When you reach the end of the message, type
49an EOT (control\-d) at the beginning of a line, which will cause
50.i Mail
51to echo \*(lqEOT\*(rq and return you to the Shell. When the user you sent mail
52to next logs in, he will receive the message:
53.(l
54You have mail.
55.)l
56to alert him to the existence of your message.
57.pp
58If, while you are composing the message
59you decide that you do not wish to send it after all, you can
60abort the letter with a \s-2RUBOUT\s0. Typing a single \s-2RUBOUT\s0
61causes
62.i Mail
63to print
64.(l
65(Interrupt -- one more to kill letter)
66.)l
67Typing a second
68\s-2RUBOUT\s0 causes
69.i Mail
70to save your partial letter on the file
71.q dead.letter
72in your home directory and abort the letter.
73Once you have
74sent mail to someone, there is no way to undo the act, so be
75careful.
76.pp
77The message your recipient reads will consist of the message you
78typed, preceded by a line telling who sent the message (your login name)
79and the date and time it
80was sent.
81.pp
82If you want to send the same message to several other people, you can list
83their login names on the command line.
84Thus,
85.(l
86% Mail sam bob john
87Tuition fees are due next Friday. Don't forget!!
88<Control\-d>
89EOT
90%
91.)l
92will send the reminder to sam, bob, and john.
93.pp
94If, when you log in, you see the message,
95.(l
96You have mail.
97.)l
98you can read the mail by typing simply:
99.(l
100% Mail
101.)l
102.i Mail
103will respond by typing its version number and date and then listing
104the messages you have waiting. Then it will type a prompt and await
105your command. The messages are assigned numbers starting with 1 \*- you
106refer to the messages with these numbers.
107.i Mail
8c80966d 108keeps track of which messages are
0d192f4a
KD
109.i new
110(have been sent since you last read your mail) and
111.i read
112(have been read by you). New messages have an
113.b N
114next to them in the header listing and old, but unread messages have
115a
116.b U
117next to them.
118.i Mail
119keeps track of new/old and read/unread messages by putting a
120header field called
121.q Status
122into your messages.
123.pp
124To look at a specific message, use the
125.b type
126command, which may be abbreviated to simply
127.b t .
128For example, if you had the following messages:
129.(l
130N 1 root Wed Sep 21 09:21 "Tuition fees"
131N 2 sam Tue Sep 20 22:55
132.)l
133you could examine the first message by giving the command:
134.(l
135type 1
136.)l
137which might cause
138.i Mail
139to respond with, for example:
140.(l
141Message 1:
142From root Wed Sep 21 09:21:45 1978
143Subject: Tuition fees
144Status: R
145
146Tuition fees are due next Wednesday. Don't forget!!
147
148.)l
149Many
150.i Mail
151commands that operate on messages take a message number as an
152argument like the
153.b type
154command. For these commands, there is a notion of a current
155message. When you enter the
156.i Mail
157program, the current message is initially the first one. Thus,
158you can often omit the message number and use, for example,
159.(l
160t
161.)l
162to type the current message. As a further shorthand, you can type a message
163by simply giving its message number. Hence,
164.(l
1651
166.)l
167would type the first message.
168.pp
169Frequently, it is useful to read the messages in your mailbox in order,
170one after another. You can read the next message in
171.i Mail
172by simply typing a newline. As a special case, you can type a newline
173as your first command to
174.i Mail
175to type the first message.
176.pp
177If, after typing a message, you wish to immediately send a reply,
178you can do so with the
179.b reply
180command.
181.b Reply ,
182like
183.b type ,
184takes a message number as an argument.
185.i Mail
186then begins a message addressed to the user who sent you the message.
187You may then type in your letter in reply, followed by a <control-d>
188at the beginning of a line, as before.
189.i Mail
190will type EOT, then type the ampersand prompt to indicate its readiness
191to accept another command. In our example, if, after typing the
192first message, you wished to reply to it, you might give the command:
193.(l
194reply
195.)l
196.i Mail
197responds by typing:
198.(l
199To: root
200Subject: Re: Tuition fees
201.)l
202and waiting for you to enter your letter.
203You are now in the message collection mode described at the beginning
204of this section and
205.i Mail
206will gather up your message up to a control\-d.
207Note that it copies the subject
208header from the original message. This is useful in that correspondence
209about a particular matter will tend to retain the same subject heading,
210making it easy to recognize. If there are other header fields in
211the message, the information found will also be used.
212For example, if the letter had a
213.q "To:"
214header listing several recipients,
215.i Mail
216would arrange to send your replay to the same people as well.
217Similarly, if the original message contained a
218.q "Cc:"
219(carbon copies to) field,
220.i Mail
221would send your reply to
222.i those
223users, too.
224.i Mail
225is careful, though, not too send the message to
226.i you ,
227even if you appear in the
228.q "To:"
229or
230.q "Cc:"
231field, unless you ask to be included explicitly. See section 4 for more
232details.
233.pp
234After typing in your letter, the dialog with
235.i Mail
236might look like the following:
237.(l
238reply
239To: root
240Subject: Tuition fees
241
242Thanks for the reminder
243EOT
244&
245.)l
246.pp
247The
248.b reply
249command is especially useful for sustaining extended conversations
250over the message system, with other
251.q listening
252users receiving copies of the conversation. The
253.b reply
254command can be abbreviated to
255.b r .
256.pp
257Sometimes you will receive a message that has been sent to
258several people and wish to reply
259.i only
260to the person who sent it.
261.b Reply
262with a capital
263.b R
264replies to a message, but sends a copy to the sender only.
265.pp
266If you wish, while reading your mail, to send a message to someone,
267but not as a reply to one of your messages, you can send the message
268directly with the
269.b mail
270command, which takes as arguments the names of the recipients you wish
271to send to. For example, to send a message to
272.q frank,
273you would do:
274.(l
275mail frank
276This is to confirm our meeting next Friday at 4.
277EOT
278&
279.)l
280The
281.b mail
282command can be abbreviated to
283.b m .
284.pp
285Normally, each message you receive is saved in the file
286.i mbox
287in your login directory at the time you leave
288.i Mail .
289Often,
290however, you will not want to save a particular message you
291have received because it is only of passing interest. To avoid
292saving a message in
293.i mbox
294you can delete it using the
295.b delete
296command. In our example,
297.(l
298delete 1
299.)l
300will prevent
301.i Mail
302from saving message 1 (from root) in
303.i mbox .
304In addition to not saving deleted messages,
305.i Mail
306will not let
307you type them, either. The effect is to make the message disappear
308altogether, along with its number. The
309.b delete
310command can be abbreviated to simply
311.b d .
312.pp
313Many features of
314.i Mail
315can be tailored to your liking with the
316.b set
317command. The
318.b set
319command has two forms, depending on whether you are setting
320a
321.i binary
322option or a
323.i valued
324option.
325Binary options are either on or off. For example, the
326.q ask
327option informs
328.i Mail
329that each time you send a message, you want it to prompt you for
330a subject header, to be included in the message.
331To set the
332.q ask
333option, you would type
334.(l
335set ask
336.)l
337.pp
338Another useful
339.i Mail
340option is
341.q hold.
342Unless told otherwise,
343.i Mail
344moves the messages from your system mailbox to the file
345.i mbox
346in your home directory when you leave
347.i Mail .
348If you want
349.i Mail
350to keep your letters in the system mailbox instead, you can set the
351.q hold
352option.
353.pp
354Valued options are values which
355.i Mail
356uses to adapt to your tastes. For example, the
357.q SHELL
358option tells
359.i Mail
360which shell you like to use, and is specified by
361.(l
362set SHELL=/bin/csh
363.)l
364for example. Note that no spaces are allowed in
365.q "SHELL=/bin/csh."
366A complete list of the
367.i Mail
368options appears in section 5.
369.pp
370Another important valued option is
371.q crt.
372If you use a fast video terminal, you will find that when you
373print long messages, they fly by too quickly for you to read them.
374With the
375.q crt
376option, you can make
377.i Mail
378print any message larger than a given number of lines by sending
8c80966d
CL
379it through a paging program. This program is specified by the
380valued option \fBPAGER\fP.
381If \fBPAGER\fP is not set, a default paginator is used.
0d192f4a
KD
382For example, most CRT users with 24-line screens should do:
383.(l
384set crt=24
385.)l
386to paginate messages that will not fit on their screens.
8c80966d
CL
387In the default state, \fImore\fP (default paginator) prints a screenful of
388information, then types --More--. Type a space to see the next screenful.
0d192f4a
KD
389.pp
390Another adaptation to user needs that
391.i Mail
392provides is that of
393.i aliases .
394An alias is simply a name which stands for one or more
395real user names.
396.i Mail
397sent to an alias is really sent to the list of real users
398associated with it. For example, an alias can be defined for the
399members of a project, so that you can send mail to the whole project
400by sending mail to just a single name. The
401.b alias
402command in
403.i Mail
404defines an alias. Suppose that the users in a project are
405named Sam, Sally, Steve, and Susan. To define an alias called
406.q project
407for them, you would use the
408.i Mail
409command:
410.(l
411alias project sam sally steve susan
412.)l
413The
414.b alias
415command can also be used to provide a convenient name for someone
416whose user name is inconvenient. For example, if a user named
417.q "Bob Anderson"
418had the login name
419.q anderson,"
420you might want to use:
421.(l
422alias bob anderson
423.)l
424so that you could send mail to the shorter name,
425.q bob.
426.pp
427While the
428.b alias
429and
430.b set
431commands allow you to customize
432.i Mail ,
433they have the drawback that they must be retyped each time you enter
434.i Mail .
435To make them more convenient to use,
436.i Mail
437always looks for two files when it is invoked. It first reads
438a system wide file
439.q /usr/lib/Mail.rc,
440then a user specific file,
441.q .mailrc,
442which is found in the user's home directory.
443The system wide file
444is maintained by the system administrator and
445contains
446.b set
447commands that are applicable to all users of the system.
448The
449.q .mailrc
450file is usually used by each user to set options the way he likes
451and define individual aliases.
452For example, my .mailrc file looks like this:
453.(l
454set ask nosave SHELL=/bin/csh
455.)l
456As you can see, it is possible to set many options in the
457same
458.b set
459command. The
460.q nosave
461option is described in section 5.
462.pp
463Mail aliasing is implemented
464at the system-wide level
465by the mail delivery
466system
467.i sendmail .
468These aliases are stored in the file /usr/lib/aliases and are
469accessible to all users of the system.
470The lines in /usr/lib/aliases are of
471the form:
472.(l
473alias: name\*<1\*>, name\*<2\*>, name\*<3\*>
474.)l
475where
476.i alias
477is the mailing list name and the
478.i name\*<i\*>
479are the members of the list. Long lists can be continued onto the next
480line by starting the next line with a space or tab. Remember that you
481must execute the shell command
482.i newaliases
483after editing /usr/lib/aliases since the delivery system
484uses an indexed file created by
485.i newaliases .
486.pp
487We have seen that
488.i Mail
489can be invoked with command line arguments which are people
490to send the message to, or with no arguments to read mail.
491Specifying the
492.rb \-f
493flag on the command line causes
494.i Mail
495to read messages from a file other than your system mailbox.
496For example, if you have a collection of messages in
497the file
498.q letters
499you can use
500.i Mail
501to read them with:
502.(l
503% Mail \-f letters
504.)l
505You can use all
506the
507.i Mail
508commands described in this document to examine, modify, or delete
509messages from your
510.q letters
511file, which will be rewritten when you leave
512.i Mail
513with the
514.b quit
515command described below.
516.pp
517Since mail that you read is saved in the file
518.i mbox
519in your home directory by default, you can read
520.i mbox
521in your home directory by using simply
522.(l
523% Mail \-f
524.)l
525.pp
526Normally, messages that you examine using the
527.b type
528command are saved in the file
529.q mbox
530in your home directory if you leave
531.i Mail
532with the
533.b quit
534command described below.
535If you wish to retain a message in your system mailbox
536you can use the
537.b preserve
538command to tell
539.i Mail
540to leave it there.
541The
542.b preserve
543command accepts a list of message numbers, just like
544.b type
545and may be abbreviated to
546.b pre .
547.pp
548Messages in your system mailbox that you do not examine are
549normally retained in your system mailbox automatically.
550If you wish to have such a message saved in
551.i mbox
552without reading it, you may use the
553.b mbox
554command to have them so saved. For example,
555.(l
556mbox 2
557.)l
558in our example would cause the second message (from sam)
559to be saved in
560.i mbox
561when the
562.b quit
563command is executed.
564.b Mbox
565is also the way to direct messages to your
566.i mbox
567file if you have set the
568.q hold
569option described above.
570.b Mbox
571can be abbreviated to
572.b mb .
573.pp
574When you have perused all the messages of interest, you can leave
575.i Mail
576with the
577.b quit
578command, which saves the messages you have typed but not
579deleted in the file
580.i mbox
581in your login directory. Deleted messages are discarded irretrievably,
582and messages left untouched are preserved in your system mailbox so
583that you will see them the next time you type:
584.(l
585% Mail
586.)l
587The
588.b quit
589command can be abbreviated to simply
590.b q .
591.pp
592If you wish for some reason to leave
593.i Mail
594quickly without altering either your system mailbox or
595.i mbox ,
596you can type the
597.b x
598command (short for
599.b exit ),
600which will immediately return you to the Shell without changing anything.
601.pp
602If, instead, you want to execute a Shell command without leaving
603.i Mail ,
604you
605can type the command preceded by an exclamation point, just as in the
606text editor. Thus, for instance:
607.(l
608!date
609.)l
610will print the current date without leaving
611.i Mail .
612.pp
613Finally, the
614.b help
615command is available to print out a brief summary of the
616.i Mail
617commands, using only the single character command abbreviations.