Upstream qmail 1.01
[qmail] / qmail-header.5
1 .TH qmail-header 5
2 .SH NAME
3 qmail-header \- format of a mail message
4 .SH OVERVIEW
5 At the top of every mail message is a
6 highly structured
7 .BR header .
8 Many programs expect the header to carry certain information,
9 as described below.
10 The main function of
11 .B qmail-inject
12 is to make sure that each outgoing message has an appropriate header.
13
14 For more detailed information, see RFC 822 and RFC 1123.
15 .SH "MESSAGE STRUCTURE"
16 A message contains a series of
17 .I header fields\fR,
18 a blank line,
19 and a
20 .IR body :
21
22 .EX
23 Received: (qmail-queue invoked by uid 666);
24 .br
25 30 Jul 1996 11:54:54 -0000
26 .br
27 From: djb@silverton.berkeley.edu (D. J. Bernstein)
28 .br
29 To: fred@silverton.berkeley.edu
30 .br
31 Date: 30 Jul 1996 11:54:54 -0000
32 .br
33 Subject: Go, Bears!
34 .br
35
36 .br
37 I've got money on this one. How about you?
38 .br
39
40 .br
41 ---Dan (this is the third line of the body)
42 .EE
43
44 Each header field has a
45 .IR name ,
46 a colon,
47 some
48 .IR contents ,
49 and a newline:
50
51 .EX
52 Subject: Go, Bears!
53 .EE
54
55 The field contents may be folded across several lines.
56 Each line past the first must begin with a space or tab:
57
58 .EX
59 Received: (qmail-queue invoked by uid 666);
60 .br
61 30 Jul 1996 11:54:54 -0000
62 .EE
63
64 The field name must not contain spaces, tabs, or colons.
65 Also, an empty field name is illegal.
66 .B qmail-inject
67 does not allow field names with unprintable characters.
68
69 Case is irrelevant in field names:
70 .B subject
71 and
72 .B SUBJECT
73 and
74 .B SuBjEcT
75 have the same meaning.
76 .SH "ADDRESS LISTS"
77 Certain fields, such as
78 .BR To ,
79 contain
80 .I address lists\fR.
81
82 An address list contains some number of
83 .I addresses
84 or
85 .I address groups\fR,
86 separated by commas:
87
88 .EX
89 a@b, c@d (Somebody), A Person <e@f>,
90 .br
91 random group: g@h, i@j;, k@l
92 .EE
93
94 An
95 .I address group
96 has some text, a colon, a list of addresses,
97 and a semicolon:
98
99 .EX
100 random group: g@h, i@j;
101 .EE
102
103 An address can appear in several forms.
104 The most common form is
105 .IR box@host .
106
107 Every address must include a host name.
108 If
109 .B qmail-inject
110 sees a lone box name
111 it adds the
112 .I default host name\fR.
113
114 All host names should be fully qualified.
115 .B qmail-inject
116 appends the
117 .I default domain name
118 to any name without dots:
119
120 .EX
121 djb@silverton -> djb@silverton.berkeley.edu
122 .EE
123
124 It appends the
125 .I plus domain name
126 to any name
127 that ends with a plus sign:
128
129 .EX
130 eric@mammoth.cs+ -> eric@mammoth.cs.berkeley.edu
131 .EE
132
133 A host name may be a dotted-decimal address:
134
135 .EX
136 djb@[128.32.183.163]
137 .EE
138
139 RFC 822 allows mailbox names inside angle brackets
140 to include
141 .I source routes\fR,
142 but
143 .B qmail-inject
144 strips all source routes out of addresses.
145 .SH "SENDER ADDRESSES"
146 .B qmail-inject
147 looks for sender address lists in the following fields:
148 .BR Sender ,
149 .BR From ,
150 .BR Reply-To ,
151 .BR Return-Path ,
152 .BR Return-Receipt-To ,
153 .BR Errors-To ,
154 .BR Resent-Sender ,
155 .BR Resent-From ,
156 .BR Resent-Reply-To .
157
158 If there is no
159 .B From
160 field,
161 .B qmail-inject
162 adds a new
163 .B From
164 field with the name of the user invoking
165 .B qmail-inject.
166
167 RFC 822 requires that certain sender fields contain
168 only a single address, but
169 .B qmail-inject
170 does not enforce this restriction.
171 .SH "RECIPIENT ADDRESSES"
172 .B qmail-inject
173 looks for recipient address lists in the following fields:
174 .BR To ,
175 .BR Cc ,
176 .BR Bcc ,
177 .BR Apparently-To ,
178 .BR Resent-To ,
179 .BR Resent-Cc ,
180 .BR Resent-Bcc .
181
182 Every message must contain at least one
183 .B To
184 or
185 .B Cc
186 or
187 .BR Bcc .
188 .B qmail-inject
189 deletes any
190 .B Bcc
191 field.
192 If there is no
193 .B To
194 or
195 .B Cc
196 field,
197 .B qmail-inject
198 adds a line
199
200 .EX
201 Cc: recipient list not shown: ;
202 .EE
203
204 This complies with RFC 822;
205 it also works around some strange
206 .B sendmail
207 behavior, in case the message is passed through
208 .B sendmail
209 on another machine.
210 .SH STAMPS
211 Every message must contain a
212 .B Date
213 field, with the date in a strict format defined by RFC 822.
214 If necessary
215 .B qmail-inject
216 creates a new
217 .B Date
218 field with the current date (in GMT).
219
220 Every message should contain a
221 .B Message-Id
222 field.
223 The field contents are a unique worldwide identifier for this message.
224 If necessary
225 .B qmail-inject
226 creates a new
227 .B Message-Id
228 field.
229
230 Another important field is
231 .BR Received .
232 Every time the message is sent from one system to another,
233 a new
234 .B Received
235 field is added to the top of the message.
236 .B qmail-inject
237 does not create any
238 .B Received
239 fields.
240 .SH "RESENT MESSAGES"
241 A message is
242 .I forwarded
243 if it contains any of the following fields:
244 .BR Resent-Sender ,
245 .BR Resent-From ,
246 .BR Resent-Reply-To ,
247 .BR Resent-To ,
248 .BR Resent-Cc ,
249 .BR Resent-Bcc ,
250 .BR Resent-Date ,
251 .BR Resent-Message-ID .
252
253 If a message is forwarded,
254 .B qmail-inject
255 changes its behavior as follows.
256
257 It deletes any
258 .B Resent-Bcc
259 field (as well as any
260 .B Bcc
261 field);
262 if there are no
263 .B Resent-To
264 or
265 .B Resent-Cc
266 fields,
267 .B qmail-inject
268 adds an appropriate
269 .B Resent-Cc
270 line.
271 It does
272 .I not
273 add a
274 .B Cc
275 line,
276 even if neither
277 .B To
278 nor
279 .B Cc
280 is present.
281
282 If there is no
283 .B Resent-From
284 field,
285 .B qmail-inject
286 adds a new
287 .B Resent-From
288 field.
289 It does
290 .I not
291 add a new
292 .B From
293 field.
294
295 .B qmail-inject
296 adds
297 .B Resent-Date
298 if one is not already present;
299 same for
300 .BR Resent-Message-Id .
301 It does
302 .I not
303 add new
304 .B Date
305 or
306 .B Message-Id
307 fields.
308 .SH "OTHER FEATURES"
309 Addresses are separated by commas, not spaces.
310 When
311 .B qmail-inject
312 sees an illegal space,
313 it inserts a comma:
314
315 .EX
316 djb fred -> djb, fred
317 .EE
318
319 .B qmail-inject
320 removes all
321 .B Return-Path
322 header fields.
323
324 .B qmail-inject
325 also removes any
326 .B Content-Length
327 fields.
328 .SH "SEE ALSO"
329 addresses(5),
330 envelopes(5),
331 qmail-inject(8)