summaryrefslogtreecommitdiff
path: root/static/plan9-4e/man1/mail.1
blob: 09a8715d66f3facfed0eb0160c5d095050855915 (plain)
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
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
.TH MAIL 1
.SH NAME
mail, marshal, nedmail, send, aliasmail, smtp, smtpd, vwhois, filter, fs, biff, pop3, ml, mlmgr, mlowner, list, deliver, token, vf \-  mail commands
.SH SYNOPSIS
.B mail
[
.I arg ...
]
.PP
.B upas/marshal
[
.B -t
.I mime-type
]
[
.B -[aA]
.I attachment
]
[
.B -s
.I subject
]
[
.B -r
]
[
.B -x
]
[
.B -#
]
[
.B -n
]
[
.I mailaddr ...
]
.PP
.B upas/send
[
.B -b
]
[
.B -i
]
[
.B -r
]
[
.B -x
]
[
.B -#
]
[
.B -n
]
[
.I mailaddr ...
]
.PP
.B upas/nedmail
[
.B -c [dir]
]
[
.B -r
]
[
.B -n
]
[
.B -f
.I mailfile
]
[
.B -s
.I mailfile
]
.PP
.B upas/fs
[
.B -f
.I mailbox
]
[
.B -b
]
[
.B -n
]
[
.B -p
]
.PP
.B upas/biff
.PP
.B upas/filter
[
.B -bh
]
.I rcvr
.I mailbox
.I "regexp file
[
.I "regexp file
]*
.PP
.B upas/list add|check
.I patterns
.I addrfile ...
.PP
.B upas/deliver 
.I recipient
.I fromfile
.I mbox
.PP
.B upas/token
.I key
[
.I tokenfile
]
.PP
.B upas/pop3
.PP
.B upas/mlmgr -c
.I listname
.PP
.B upas/mlmgr -ar
.I listname
.I address
.PP
.B upas/ml
.I addressfile
.I listname
.PP
.B upas/mlowner
.I addressfile
.I listname
.PP
upas/vf
.SH DESCRIPTION
.SS Mail
Mail is a shell script that invokes
.I upas/nedmail
when no  recipients appear on the command line and
.I upas/marshal
otherwise.
All command line options are passed through.
.SS "Sending mail
.I Marshal
builds a mail message from standard input and passes it
for transmission or delivery to
.B /bin/myupassend
if it exists, otherwise to
.BR /bin/upas/send .
The message format is both RFC 822 and
MIME conformant, so
.I marshal
adds any required headers not already in the message.
Before adding any necessary header lines, it prepends
the contents of
.BI /mail/box/ username /headers\f1.
This allows the addition of personal headers like
.B From:
lines with a full name or a different
return address.
Command line options direct marshal to add a subject line
and append attachments.  The arguments to
.I marshal
are the addresses of the recipients.
.PP
When running in a
.IR rio (1)
window,
.I marshal
automatically puts the window into hold mode (see
.IR rio (1));
this means that the message can be edited freely,
because nothing will be sent to
.I marshal
until the ESC key is hit to exit hold mode.
.PP
The options are:
.TF "-a file"
.TP
.BI -a file
directs
.I marshal
to append 
.I file
as a mime attachment.
Unless explicitly specified by the
.B -t
option, the type of the attachment is determined
by running the
.IR file (1)
command.
.TP
.BI -A file
is like
.B -a
but the message disposition is marked as
.I inline
directing any mail reader to display the attachment
(if it can) when the mail message is read.
.TP
.BI -t type
sets the content type for the attachments from
all subsequent
.B -a
and
.B -A
options.
.TP
.BI -s subject
adds a
.B Subject:
header line to the message if one does not
already exist.
.TP
.B -#xnr
are all passed as command line options to the
.I send
that
.I marshal
invokes.
.PD
.PP
.I Send
reads a message from standard input and disposes of it in one
of four ways:
.IP \(bu 3
If
.I mailaddr
refers to a local mailbox, it appends it to the
recipient's mailbox.
.IP \(bu
If
.I mailaddr
is remote, it queues the mail for remote delivery.
.IP \(bu
If the
.B -r
option is given and the mail is undeliverable, it
returns the mail to the sender.
.IP \(bu
if the
.B -r
option is not given and the mail is undeliverable, it
appends the mail to
.BI /mail/box/ username /dead.letter
and prints a message to standard error.
.PP
The file
.B /mail/lib/rewrite
determines exactly how to deliver or queue the mail.
The decision is based purely on the recipient address.
.PP
The options are:
.TF -b
.TP
.B -b
suppresses the addition of the
.B To:
line.
.TP
.B -i
let the message input be terminated by a line
containing only a period, for
compatibility with
old mailers.
.TP
.B -x
do not send mail, but instead report
the full mail address of the recipient.
.TP
.B -#
do not send mail, but instead report
what command would be used to send the mail.
.TP
.B -r
input is via a pipe from another program.
Expect a From
line at the start of the message to provide the
name of the sender and timestamp.  This implies
the
.B -b
option.
.SS "Reading mail"
.I Nedmail
edits a mailbox.
The default mailbox is
.BI /mail/box/ username /mbox\f1.
The
.B -f
command line option specifies an alternate mailbox.
Unrooted path names are interpreted relative to
.BI /mail/box/ username.
If the
.I mailfile
argument is omitted, the name defaults to
.BR stored .
.PP
The options are:
.TF "-f mailfile"
.TP
.BI -c " dir
Create a mailbox.  If
.I dir
is specified, the new mailbox is created in
.BI /mail/box/ username / dir /mbox\f1.
Otherwise, the default mailbox is created.
.TP
.B -r
Reverse: show messages in first-in, first-out order; the default is last-in, first-out.
.TP
.B -n
Make the message numbers the same as the file names in the mail
box directory.  This implies the
.B -r
option.
.TP
.BI -f " mailfile"
Read messages from the specified file (see above) instead of the default mailbox.
.TP
.BI -s " mailfile"
Read a single message file
.IR mailfile ,
as produced by
.IR fs ,
and treat it as an entire mailbox.
This is provided for
use in plumbing rules; see
.IR faces (1).
.PD
.PP
.I Nedmail
starts by reading the mail box, printing out the number
of messages, and then prompting for commands from standard input.
Commands, as in
.IR ed (1),
are of the form
.RI `[ range ]
.I command
.RI [ arguments ]'.
The command is applied to each message in the (optional) range.
.PP
The address range can be:
.TP 1.4i
.I address
to indicate a single message header
.PD 0
.TP
.IB address , address
to indicate a range of contiguous message headers
.TP
.BI g/ expression /
to indicate all messages whose headers match the regular
.IR expression .
.TP
.BI g% expression %
to indicate all messages whose contents match the regular
.IR expression .
.PD
.PP
The addresses can be:
.TP 1.4i
.I number
to indicate a particular message
.PD 0
.TP
.IB address . number
to indicate a subpart of a particular message
.TP
.BI / expression /
to indicate the next message whose header matches
.I expression
.TP
.BI % expression %
to indicate the next message whose contents match
expression
.TP
.I "empty or .
to indicate the current message
.TP
.BI - address
to indicate backwards search or movement
.PD
.PP
Since messages in MIME are hierarchical
structures, in
.I nedmail
all the subparts are individually addressable.
For example if message 2 contains 3 attachments,
the attachments are numbered 2.1, 2.2, and 2.3.
.PP
The commands are:
.TP 1.1i
.BI a " args
Reply to all addresses in the
.BR To: ,
.BR From: ,
and
.BR Cc:
header lines.
.I Marshal
is used to format the reply and any arguments the
user specifies are added to the command line to
.I marshal
before the recipient.
The possibility of making a fool of yourself is very
high with this command.
.PD 0
.TP
.BI A " args
Like 
.B a
but with the message
appended to the reply.
.TP
.B b
Print the headers for the next ten messages.
.TP
.B d
Mark message to be deleted upon exiting
.IR nedmail .
.TP
.B f
Append the message to the file 
.BI /mail/box/ username / sendername
where
.I sendername
is the account name of the sender.
.TP
.B h
Print the disposition, size in characters, reception time, sender,
and subject of the message.
.TP
.B H
Print the MIME structure of the message.
.TP
.B help
Print a summary of the commands.
.TP
.BI m " person ...
Forward the message as a mime attachment to the named
.IR persons .
.TP
.BI M " person ...
Like
.B m
but allow the user to type in text to be included
with the forwarded message.
.TP
.B p
Print message.	An interrupt stops the printing.
.TP
.BI r " args
Reply to the sender of the message.
.I Marshal
is used to format the reply.
If and optional
.I Args
are specified, they are added to the command line to
.I marshal
before the recipient's address.
.TP
.B R " args 
Like
.B r
but with the original message included as an attachment.
.TP
.B rf
Like
.B r
but append the message and the reply to the file 
.BI /mail/box/ username / sendername
where
.I sendername
is the account name of the sender.
.TP
.B Rf
Like 
.B R
but append the message and the reply to the file 
.BI /mail/box/ username / sendername
where
.I sendername
is the account name of the sender.
.TP
.BI s " mfile"
Append the message to the specified mailbox.
If
.I mfile
doesn't start with a `/', it is interpreted relative to the directory in which the mailbox resides.
.TP
.B q
Put undeleted mail back in the mailbox and stop.
.TP
EOT (control-D)
Same as 
.BR q .
.TP
.BI w " file
Same as
.B s
with the mail header line(s) stripped.  This can be used to
save binary mail bodies.
.TP
.B u
Remove mark for deletion.
.TP
.B x
Exit, without changing the mailbox file.
.TP
.BI | command
Run the
.I command
with the message as standard input.
.TP
.BI ! command
Escape to the shell to do
.IR command .
.TP
.B \&=
Print the number of the current message.
.PD
.PP
Here's an example of a mail session that looks at a summary
of the mail messages, saves away an html file added as an
attachment to a message and then deletes the message:
.LP
.EX
% mail
7 messages
: ,h
1   H  2129	07/22 12:30  noone@madeup.net  "Add Up To 2000 free miles"
2       504	07/22 11:43  jmk
3   H   784	07/20 09:05  presotto
4       822	07/11 09:23  xxx@yyy.net  "You don't call, you don't write..."
5       193	07/06 16:55  presotto
6       529	06/01 19:42  jmk
7       798	09/02  2000  howard
: 1H
1       multipart/mixed             2129   from=noone@madeup.net
 1.1      text/plain                115    
 1.2      text/html                 1705   filename=northwest.htm
: 1.2w /tmp/northwest.html
!saved in /tmp/northwest.html
1.2: d
1: q
!1 message deleted
% 
.EE
.PP
Notice that the delete of message 1.2 deleted the entire message and
not just the attachment.
.SS "Aliasmail"
.I Aliasmail 
expands mail aliases, its arguments, according to alias files.
Each line of an alias file begins with
.B #
(comment) or with a name.
The rest of a name line gives the expansion.
The expansion may contain multiple addresses and may be continued
to another line by appending a backslash.
Items are separated by white space.
.PP
In expanding a name, the sender's personal alias file
.BI /mail/box/ username /names 
is checked first.
Then the system alias files, listed one per line in
.BR /mail/lib/namefiles  ,
are checked in order.
If the name is not found, the expansion is taken to be
.BI local! name\f1.
Under the
.B -f
option,
alias files listed in
.B /mail/lib/fromfiles
are consulted instead,
and the domain part only of the expansion is printed.
.SS Mailboxes
Incoming mail for a user
.I username
is put in the file
.BI /mail/box/ username /mbox
unless either the file
.BI /mail/box/ username /forward
or
.BI /mail/box/ username /pipeto
exists.
The mailbox must have append-only and exclusive-access mode
(see
.IR chmod (1)).
A user must create his or her own mailbox using the
.B -c
option of
.IR nedmail .
Mailboxes are created writable (append-only) but not readable by others.
.SS Forwarding
If the file
.BI /mail/box/ username /forward
exists and is readable by everyone, incoming mail
will be forwarded to the addresses contained in the first line of the file.
The file may contain multiple addresses.
Forwarding loops are caught and resolved by local delivery.
.SS Filtering
If the file
.BI /mail/box/ username /pipeto
exists and is readable and executable by everyone,
it will be run for each incoming message for the user.
The message will be piped to it rather
than appended to his/her mail box.
The file is run as user
.B none
with arguments of the resolved address of
.I username
(e.g.,
.BR local!presotto )
and the user's mail box name.
.PP
.I Filter
provides simple mail filtering.
The first two arguments are the recipient's address and mailbox, that is,
the same arguments provided to
.BR pipeto .
The remaining arguments are all pairs of a regular expression and a file name.
With no flags, the sender's address is matched against each
regular expression starting with the first.  If the expression
matches, then the message is delivered to the file whose name
follows the expression.  The file must be world writable and should
be append only.
A message that matches none of the expressions is delivered into
the user's standard mail box.
The flags are:
.TP
.B h
the regular expression is matched against the message header
rather than the address.
.TP
.B b
the regular expression is matched against both the header and the body
of the message.
.PP
For example, to delete any messages of precedence bulk, place in
your
.B pipeto
file:
.EX
/bin/upas/filter -h $1 $2 'Precedence: bulk' /dev/null
.EE
.PP
Three other commands exist which, combined by an
.IR rc (1)
script, allow you to build your own filter.
.PP
.I List
takes two verbs;
.B check
and
.BR add .
.B Check
directs
.I list
to check each address contained in the
.IR addressfile s
against a list of patterns in
.IR patternfile .
Patterns come in four forms:
.TP
.B ~\fIregular-expression\fP
If any address matches the regular expression,
.I list
returns successfully.
.TP
.BR =\fIstring\fP .
If any address exactly matches
.IR string ,
.I list
returns successfully.
.TP
.B !~\fIregular-expression\fP
If any address matches the regular expression
and no other address matches a non `!' rule,
.I list
returns error status "!match".
.TP
.B !=\fIstring\fP
If any address exactly matches
.I string
and no other address matches a non `!' rule,
.I list
returns error status "!match".
.PP
If no addresses match a pattern,
.I list
returns "no match".
.PP
The pattern file may also contain lines of the form
.EX
#include filename
.EE
This allows pattern files to include other pattern
files.
All pattern matches are case insensitive.
.I List
searches the pattern file (and its includes) in order.
The first matching pattern determines the action.
.PP
.I List
.B add
directs
.I list
to add a pattern to
.I patternfile
for each address in the
.IR addrssfile 's
that doesh't already match a pattern.
.PP
.IR Token ,
with only one argument, prints to standard output a unique token
created from the current date and
.IR key .
With two arguments, it checks
.I token
against tokens created over the last 10 days with
.IR key .
If a match is found, it returns successfully.
.PP
.I Deliver
delivers into mail box
.I mbox
the message read from standard input.
It obeys standard mail file locking and logging
conventions.
.PP
A sample 
.B pipeto
using the filter kit can be found in
.BR /sys/src/cmd/upas/filterkit/pipeto.sample .
.PP
A sample
.BR myupassend ,
.BR /sys/src/cmd/upas/filterkit/myupassend.sample ,
is provided which adds all addresses of your outgoing
mail to your pattern file.
You should copy it into a directory that normally gets
bound by your profile onto
.BR /bin .
.SS "Mime File system
.PP
.I Fs
is a user level file system that reads mailboxes and presents them as a file
system.
A user normally starts
.I fs
in his/her profile after starting
.IR plumber (4)
and before starting
a window system, such as
.IR rio (1)
or
.IR acme (1).
The file system is used by
.I nedmail
and
.IR acme (1)'s
mail reader to parse messages.
.I Fs
also generates plumbing messages used by
.IR biff
and
.IR faces (1)
to provide mail announcements.
.PP
The mailbox itself becomes a directory under
.BR /mail/fs .
Each message in the mailbox becomes a numbered directory in the
mailbox directory, and each attachment becomes a numbered directory
in the message directory.  Since an attachment may itself be a mail message,
this structure can recurse ad nauseam.
.PP
Each message and attachment directory contains the files:
.TP 1.4i
.B body
.PD 0
the message minus the RFC822 style headers
.TP
.B cc
the address(es) from the CC: header
.TP
.B date
the date in the message, or if none, the time of delivery
.TP
.B digest
an SHA1 digest of the message contents
.TP
.B disposition
.B inline
or
.B file
.TP
.B filename
a name to use to file an attachment
.TP
.B from
the from address in the From: header, or if none,
the address on the envelope.
.TP
.B header
the RFC822 headers
.TP
.B info
described below, essentially a summary of the header info
.TP
.B inreplyto
contents of the
.B in-reply-to:
header
.TP
.B mimeheader
the mime headers
.TP
.B raw
the undecoded MIME message
.TP
.B rawbody
the undecoded message body
.TP
.B rawheader
the undecoded message header
.TP
.B replyto
the address to send any replies to.
.TP
.B subject
the contents of the subject line
.TP
.B to
the address(es) from the To: line.
.TP
.B type
the MIME content type
.TP
.B unixheader
the envelope header from the mailbox
.PD
.PP
The
.B info
file contains the following information, one item per line.  Lists
of addresses are single space separated.
.IP
.TP 2i
.I "sender address
.PD 0
.TP
.I "recipient addresses
.TP
.I "cc addresses
.TP
.I "reply address
.TP
.I "envelope date
.TP
.I "subject
.TP
.I "MIME content type
.TP
.I "MIME disposition
.TP
.I filename
.TP
.I "SHA1 digest
.TP
.I "bcc addresses
.TP
.I "in-reply-to: contents
.TP
.I "RFC822 date
.TP
.I "message senders
.TP
.I "message id
.TP
.I "number of lines in body
.PD
.PP
Deleting message directories causes the message to be removed from
the mailbox.
.PP
The mailbox is reread and the structure updated
whenever the mailbox changes.  Message directories are
not renumbered.
.PP
The file
.B /mail/fs/ctl
is used to direct
.I fs
to open/close new mailboxes or to delete groups of messages atomically.
The messages that can be written to this file are:
.TP 2i
.PD 0
.B "open \fIpath mboxname\fP
opens a new mailbox.
.I path
is the file to open, and
.I mboxname
is the name that appears under
.BR /mail/fs .
.TP
.B "close \fImboxname\fP
close
.IR mboxname .
The close takes affect only after all files open under
.BI /mail/fs/ mboxname
have been closed.
.TP
.B "delete \fImboxname number ...\fP
Delete the messages with the given numbers from
.IR mboxname.
.PD
.PP
The options are:
.TF "-f file
.TP
.BI -f file
use
.I file
as the mailbox instead of the default,
.BI /mail/box/ username /mbox.
.PD 0
.TP
.B -b
stands for biffing.  Each time new mail
is received, a message is printed to standard
output containing the sender address, subject,
and number of bytes.  It is intended for
people telnetting in who want mail announcements.
.TP
.B -n
Don't open a mailbox initially.  Overridden by -f.
.TP
.B -p
turn off plumbing.  Unless this is specified,
.I fs
sends a message to the plumb port,
.BR seemail ,
from source
.B mailfs
for each message received or deleted.
The message contains the attributes
.IR sender = "<contents of from file>" ,
.IR filetype =mail,
.IR mailtype = "deleted or new" ,
and
.IR length = "<message length in bytes>" .
The contents of the message is the full path
name of the directory representing the message.
.TP
.B -s
causes
.I fs
to put itself in
.B /srv
with a name of the form
.BR /srv/upasfs.\fIuser\fP .
.TP
.B -m
specifies a mount point other than
.BR /mail/fs .
.PD
.PP
.I Fs
will exit once all references to its directory
have disappeared.
.SS "Mail Announcements
.PP
.I Biff
is the textual equivalent of
.IR faces (1).
It listens to plumbing messages from
.I fs
and for each new message prints to standard output a line
containing the sender address, subject,
and number of bytes.
It exists for people without graphics capability or with screens too small to
dedicate the space
.IR faces (1)
requires.  It forks to place itself in the background.
.SS "Remote delivery
.PP
.I Smtp
sends the mail message from standard input
to the users
.I rcpt-list
on the host at network address
.I address 
using the Simple Mail Transfer Protocol.
The return address of the mail will contain the local
system name from the environment variable
.I sysname
and the user
.IR sender .
The
.B -h
option uses
.I host
as the local system name;
it may be fully-qualified or not.
If
.I .domain
is given, it is appended to the end of the system name.
The
.B -f
option just prints out the converted message rather than
sending it to the destination.
The
.B -g
option specifies a gateway system to pass the message to if smtp can't
find an address or MX entry for the destination system.
The
.B -d
option turns on debugging output to standard error.
.PP
.I Smtpd
receives a message using the Simple Mail Transfer Protocol.
Standard input and output are the protocol connection.
.PP
The options are:
.TP 1.1i
.B -d
turns on debugging output to standard error.
.TP
.B -r
turns on forward DNS validation of non-trusted sender address.
.TP
.B -f
prevents relaying from non-trusted networks.
.TP
.B "-n \fItcp-directory\fP"
specifies the name of the network directory assigned to the incoming connection.
This is used to determine the peer IP address.  If this flag is not
specified, the peer address is determined using standard input.
.TP
.B "-h \fIdomain\fP"
specifies the receiving domain.  If this flag is not specified, the
receiving domain is inferred from the host name.
.TP
.B -s
causes copies of blocked messages to be saved in a sub-directory of
.BR /mail/queue.dump .
.TP
.B "-k \fIIP address\fP"
causes connections from the host at
.I "IP address"
to be dropped at program startup.  Multiple addresses
can be specified with several
.B -k
options.  This option should be used carefully;
it is intended to lessen the effects of denial of
service attacks or broken mailers which continually
connect.  The connections are not logged and the
remote system is not notified via the protocol.
.PP
.I Smtpd
is normally run by a network listener such as
.IR listen (8).
Most of the command line options are more conveniently
specified in the smtpd configuration file stored in
.BR /mail/lib/smtpd.conf .
.SS "Mailing lists
.I Mlmgr
creates and updates unmoderated mailing lists.
The
.B \-c
option creates mail directories for both
.I listname
and
.IB listname -owner\f1,\fP
each containing a
.B pipeto
file.
Messages mailed to
.I listname
are sent to all members of the mailing list.
Any
.B Reply-to:
and
.B Precedence:
fields are
removed from the messages and new ones are added
directing replies to
.I listname
and specifying bulk precedence.  The envelope address for
error replies is set to
.BR /dev/null .
.PP
The mailing list membership is the file
.BR /mail/box/\fIlistname\fP/address-list .
This file is an add/remove log.  Each line
represents a single address.  Lines beginning
with a hash
.RB ( # )
are comments.
Lines beginning with an exclamation point
.RB ( ! )
are removals.
All other lines are additions.
.PP
Addition and removal entries can be appended using the
.B -a
and
.B -r
options to
.IR mlmgr .
However, they are normally appended as a consequence or
user requests.
.PP
To be added or removed from the list, a user
may send a message to
.IB listname -owner\f1.\fP
containing a key word in
the header or body.  The key words are:
.IP
subscribe - add my
.B From:
address to the list
.IP
remove - remove my
.B From:
address from the list
.IP
unsubscribe - remove my
.B From:
address from the list
.PP
Addition and removal events cause notification messages to
be sent to the added/removed address.   In the case of
addition, the message describes how to be removed.
.PP
.I Ml
and
.I mlowner
are the programs that receive messages for
.I listname
and
.IB listname -owner
respectively.
Appropriate calls to them are inserted in the
.B pipeto
files created by
.IR mlmgr .
.SS "Virus Wrapper
.I Vf
takes a mail message as standard input, searches for executable
MIME attachments, wraps them in a warning message, and appends
.B .suspect
to any related filenames.
.B /sys/lib/mimetype
contains the list of known MIME content types and file extensions.
.I Vf
wraps all those for which the fifth field of
.B mimetype
is
.BR n .
.SS "Mail server
.I Pop3
is a rudimentary POP3 server that uses APOP for authentication.
It predates
.I upas/fs
and does not use it.  It will soon be replaced by one that uses
.IR upas/fs .
See also the IMAP4 server described in
.IR ipserv (8).
.SH FILES
.TF /mail/box/*/dead.letter
.TP
.B /sys/log/mail
mail log file
.TP
.B /mail/box/*
mail directories
.TP
.B /mail/box/*/mbox
mailbox files
.TP
.B /mail/box/*/forward
forwarding address(es)
.TP
.B /mail/box/*/pipeto
mail filter
.TP
.B /mail/box/*/L.reading
mutual exclusion lock for multiple mbox readers
.TP
.B /mail/box/*/L.mbox
mutual exclusion lock for altering mbox
.TP
.B /mail/box/*/dead.letter
unmailable text
.TP
.B /mail/box/*/names
personal alias files
.TP
.B /mail/lib/rewrite
rules for handling addresses
.TP
.B /mail/lib/namefiles
lists files to search for aliases in
.TP
.B /lib/face/48x48x?
directories of icons for
.I seemail
.SH SOURCE
.TF /sys/src/cmd/upas
.TP
.B /rc/bin/mail
.TP
.B /sys/src/cmd/upas
source for commands in
.B /bin/upas
.TP
.B /sys/src/cmd/faces
.TP
.B /rc/bin/vwhois
.SH "SEE ALSO"
.IR face (6),
.IR rewrite (6)
.IR ipserv (8)
.SH BUGS
.I Nedmail
truncates
long headers for searching.
.sp
.br
.I Biff
and 
the
.B \-b
option of
.I fs
perform the same function but in slightly
different environments.
The duality is confusing.
The 
.B \-b
option exists because starting both
.I fs
and
.I biff
in a Telnet session results in a number
of processes that don't die when the
session is terminated; the
.IR plumber (4)
is held open by
.I fs
and
.I biff
still having it mounted, while
.I fs
is held open by
.I biff
which is blocked waiting for plumbing
input.