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