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