BSD 4 development
[unix-history] / usr / src / cmd / delivermail / delivermail.8
CommitLineData
e43191cd
BJ
1.TH DELIVERMAIL 8
2.SH NAME
3delivermail \- deliver mail to arbitrary people
4.SH SYNOPSIS
5.B /etc/delivermail
6[
7.BR \- [ fr ]
8.I address
9] [
10.B \-a
11] [
12.BR \-e [ empqw ]
13] [
14.B \-n
15] [
16.B \-m
17] [
18.B \-s
19] [
20.B \-i
21] [
22.B \-h
23.I N
24] address ...
25.SH DESCRIPTION
26.I Delivermail
27delivers a letter to one or more people,
28routing the letter over whatever networks
29are necessary.
30.I Delivermail
31will do inter-net forwarding as necessary
32to deliver the mail to the correct place.
33.PP
34.I Delivermail
35is not intended as a user interface routine;
36it is expected that other programs will provide user-friendly
37front ends,
38and
39.I delivermail
40will be used only to deliver pre-formatted messages.
41.PP
42.I Delivermail
43reads its standard input
44up to a control-D
45or a single dot
46and sends a copy of the letter found there
47to all of the addresses listed.
48If the
49.B \-i
50flag is given,
51single dots are ignored.
52It determines the network to use
53based on the syntax of the addresses.
54Addresses containing the character `@'
55or the word ``at''
56are sent to the
57.SM ARPANET;
58addresses containing `!'
59are sent to the
60.SM UUCP
61net,
62and addresses containing `:' or `.'
63are sent to the Berkeley network.
64Other addresses are assumed to be local.
65.PP
66Local addresses are looked up in the file
67.I /usr/lib/mailaliases
68and aliased appropriately.
69Aliasing can be prevented by preceeding the address
70with a backslash or using the
71.B \-n
72flag.
73Normally the sender is not included in any alias
74expansions, e.g.,
75if `john' sends to `group',
76and `group' includes `john' in the expansion,
77then the letter will not be delivered to `john'.
78The
79.B \-m
80flag disables this suppression.
81.PP
82.I Delivermail
83computes the person sending the mail
84by looking at your login name.
85The ``from'' person
86can be explicitly specified by using the
87.B \-f
88flag;
89or, if the
90.B \-a
91flag is given,
92delivermail looks in the body of the message
93for a ``From:'' or ``Sender:''
94field in
95.SM ARPANET
96format.
97The
98.B \-f
99and
100.B \-a
101flags can be used
102only by the special users
103.I root
104and
105.I network,
106or if the person you are trying to become
107is the same as the person you are.
108The
109.B \-r
110flag is entirely equivalent to the
111.B \-f
112flag; it is provided for ease of interface only.
113.PP
114The
115.BI \-e x
116flag controls the disposition of error output,
117as follows:
118.TP 3n
119.B e
120Print errors on the standard output,
121and echo a copy of the message when done.
122It is assumed that a network server will
123return the message back to the user.
124.TP
125.B m
126Mail errors back to the user.
127.TP
128.B p
129Print errors on the standard output.
130.TP
131.B q
132Throw errors away;
133only exit status is returned.
134.TP
135.B w
136Write errors back to the user's terminal,
137but only if the user is still logged in
138and write permission is enabled;
139otherwise errors are mailed back.
140.LP
141If the error is not mailed back,
142and if the mail originated on the machine where the error occurred,
143the letter is appended to the file
144.I dead.letter
145in the sender's home directory.
146.PP
147If the first character of the user name
148is a vertical bar,
149the rest of the user name is used as the name of a program
150to pipe the mail to.
151It may be necessary to quote the name of the user
152to keep
153.I delivermail
154from supressing the blanks from between arguments.
155.PP
156The message is normally editted to eliminate ``From''
157lines that might confuse other mailers.
158In particular,
159``From'' lines in the header are deleted,
160and ``From'' lines in the body are prepended by `>'.
161The
162.B \-s
163flag saves ``From'' lines in the header.
164.PP
165The
166.B \-h
167flag gives a ``hop-count'', i.e.,
168a measure of how many times this message
169has been processed by
170.I delivermail
171(presumably on different machines).
172Each time
173.I delivermail
174processes a message,
175it increases the hop-count by one;
176if it exceeds 30
177.I delivermail
178assumes that an alias loop has occured
179and it aborts the message.
180The hop-count defaults to zero.
181.PP
182.I Delivermail
183returns an exit status
184describing what it did.
185The codes are defined in
186.IR mailexits.h :
187.ta 3n +\w'EX_UNAVAILABLE'u+3n
188.de XX
189.ti \n(.iu
190..
191.in +\w'EX_UNAVAILABLE'u+6n
192.XX
1930 EX_OK Succesful completion on all addresses.
194.XX
1952 EX_NOUSER User name not recognized.
196.XX
1973 EX_UNAVAILABLE Catchall meaning necessary resources
198were not available.
199.XX
2004 EX_SYNTAX Syntax error in address.
201.XX
2025 EX_SOFTWARE Internal software error,
203including bad arguments.
204.XX
2056 EX_OSERR Temporary operating system error,
206such as ``cannot fork''.
207.XX
2087 EX_NOHOST Host name not recognized.
209.DT
210.PP
211.SH FILES
212.in +10
213.ti -10
214/usr/lib/mailaliases \- to alias names
215.ti -10
216/bin/mail \- to deliver local mail
217.ti -10
218/usr/net/bin/sendmail \- to deliver Berkeley mail
219.ti -10
220/usr/lib/mailers/arpa \- to deliver
221.SM ARPANET
222mail
223.ti -10
224/usr/lib/mailers/uucp \- to deliver
225.SM UUCP
226mail
227.ti -10
228/tmp/mail* \- temp file
229.ti -10
230/tmp/xscript* \- saved transcript
231.ti -10
232/dev/log \- to log status (optional)
233.in -10
234.SH SEE\ ALSO
235mail(1), Mail(UCB), arpa-mailer(8), uucp-mailer(8),
236mailaliases(5), userinfo(5)
237.SH BUGS
238.I Delivermail
239sends one copy of the letter
240to each user;
241it should send one copy
242of the letter to each host
243and distribute to multiple users there
244whenever possible.
245.PP
246.I Delivermail
247assumes the addresses can be represented as one word.
248This is incorrect according to the
249.SM ARPANET
250mail protocol RFC 733 (NIC 41952),
251but is consistant with the real world.