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