summaryrefslogtreecommitdiff
path: root/envelopes.5
blob: 5f7084ab93aae6a5d70fb4645dce6e5d3ca590c6 (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
.TH envelopes 5
.SH "NAME"
envelopes \- sender/recipient lists attached to messages
.SH "INTRODUCTION"
Electronic mail messages are delivered in
.IR envelopes .

An envelope lists a
.I sender
and one or more
.IR recipients .
Usually these
envelope addresses are the same
as the addresses listed in the message header:

.EX
   (envelope) from djb to root
.br
   From: djb
.br
   To: root
.EE

In more complicated situations, though,
the envelope addresses may differ from the header addresses.
.SH "ENVELOPE EXAMPLES"
When a message is delivered to
several people at different locations,
it is first photocopied
and placed into several envelopes:

.EX
   (envelope) from djb to root
.br
   From: djb                          Copy #1 of message
.br
   To: root, god@brl.mil
.EE

.EX
   (envelope) from djb to god@brl.mil
.br
   From: djb                          Copy #2 of message
.br
   To: root, god@brl.mil
.EE

When a message is delivered
to several people at the same location,
the sender doesn't have to photocopy it.
He can instead stuff it into
one envelope with several addresses;
the recipients will make the photocopy:

.EX
   (envelope) from djb to god@brl.mil, angel@brl.mil
.br
   From: djb
.br
   To: god@brl.mil, angel@brl.mil, joe, frde
.EE

Bounced mail is sent back to the envelope sender address.
The bounced mail doesn't list an envelope sender,
so bounce loops are impossible:

.EX
   (envelope) from <> to djb
.br
   From: MAILER-DAEMON
.br
   To: djb
.br
   Subject: unknown user frde
.EE

The recipient of a message may make another copy
and forward it in a new envelope:

.EX
   (envelope) from djb to joe
.br
   From: djb                          Original message
.br
   To: joe
.EE

.EX
   (envelope) from joe to fred
.br
   From: djb                          Forwarded message
.br
   To: joe
.EE

A mailing list works almost the same way:

.EX
   (envelope) from djb to sos-list
.br
   From: djb                          Original message
.br
   To: sos-list
.EE

.EX
   (envelope) from sos-owner to god@brl.mil
.br
   From: djb                          Forwarded message
.br
   To: sos-list                       to recipient #1
.EE

.EX
   (envelope) from sos-owner to frde
.br
   From: djb                          Forwarded message
.br
   To: sos-list                       to recipient #2
.EE

Notice that the mailing list is set up
to replace the envelope sender with something new,
.BR sos-owner .
So bounces will come back to
.BR sos-owner :

.EX
   (envelope) from <> to sos-owner
.br
   From: MAILER-DAEMON
.br
   To: sos-owner
.br
   Subject: unknown user frde
.EE

It's a good idea to set up an extra address,
.BR sos-owner ,
like this:
the original envelope sender (\fBdjb\fP)
has no way to fix bad
.B sos-list
addresses,
and of course bounces must not be sent to 
.B sos-list
itself.
.SH "HOW ENVELOPE ADDRESSES ARE STORED"
Envelope sender and envelope recipient addresses
are transmitted and recorded in several ways.

When a user injects mail through
.BR qmail-inject ,
he can supply a
.B Return-Path
line or a
.B \-f
option for the envelope sender;
by default the envelope sender is his login name.
The envelope recipient addresses can be taken
from the command line or from various header fields,
depending on the options to
.BR qmail-inject .
Similar comments apply to
.BR sendmail .

When a message is transferred from one machine to another through SMTP,
the envelope sender is given in a
.B MAIL FROM
command,
the envelope recipients are given in 
.B RCPT TO
commands,
and the message is supplied separately by a 
.B DATA
command.

When a message is delivered by
.B qmail
to a single local recipient,
.B qmail-local
records the recipient in
.B Delivered-To
and the envelope sender in
.BR Return-Path .
It uses
.B Delivered-To
to detect mail forwarding loops.

.B sendmail
normally records the envelope sender in
.BR Return-Path .
It does not record envelope recipient addresses,
on the theory that they are redundant:
you received the mail,
so you must have been one of the envelope recipients.

Note that,
if the header doesn't have any recipient addresses,
.B sendmail
will move envelope recipient addresses back into the header.
This situation occurs if all addresses were originally listed as
.BR Bcc ,
since
.B Bcc
is automatically removed.
When
.B sendmail
sees this, it creates a new
.B Apparently-To
header field with the envelope recipient addresses.
This has the strange effect that each blind-carbon-copy recipient will see
a list of all recipients on the same machine.

When a message is stored in
.B mbox
format,
the envelope sender is recorded at the top of the message
as a UUCP-style
.B From
(no colon) line.
Note that this line is less reliable than the
.B Return-Path
line added by
.B qmail-local
or
.B sendmail\fP.
.SH "SEE ALSO"
qmail-header(5),
qmail-local(8),
qmail-inject(8)