Upstream qmail 1.01
[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
14For more detailed information, see RFC 822 and RFC 1123.
15.SH "MESSAGE STRUCTURE"
16A message contains a series of
17.I header fields\fR,
18a blank line,
19and 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
44Each header field has a
45.IR name ,
46a colon,
47some
48.IR contents ,
49and a newline:
50
51.EX
52 Subject: Go, Bears!
53.EE
54
55The field contents may be folded across several lines.
56Each 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
64The field name must not contain spaces, tabs, or colons.
65Also, an empty field name is illegal.
66.B qmail-inject
67does not allow field names with unprintable characters.
68
69Case is irrelevant in field names:
70.B subject
71and
72.B SUBJECT
73and
74.B SuBjEcT
75have the same meaning.
76.SH "ADDRESS LISTS"
77Certain fields, such as
78.BR To ,
79contain
80.I address lists\fR.
81
82An address list contains some number of
83.I addresses
84or
85.I address groups\fR,
86separated 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
94An
95.I address group
96has some text, a colon, a list of addresses,
97and a semicolon:
98
99.EX
100 random group: g@h, i@j;
101.EE
102
103An address can appear in several forms.
104The most common form is
105.IR box@host .
106
107Every address must include a host name.
108If
109.B qmail-inject
110sees a lone box name
111it adds the
112.I default host name\fR.
113
114All host names should be fully qualified.
115.B qmail-inject
116appends the
117.I default domain name
118to any name without dots:
119
120.EX
121 djb@silverton -> djb@silverton.berkeley.edu
122.EE
123
124It appends the
125.I plus domain name
126to any name
127that ends with a plus sign:
128
129.EX
130 eric@mammoth.cs+ -> eric@mammoth.cs.berkeley.edu
131.EE
132
133A host name may be a dotted-decimal address:
134
135.EX
136 djb@[128.32.183.163]
137.EE
138
139RFC 822 allows mailbox names inside angle brackets
140to include
141.I source routes\fR,
142but
143.B qmail-inject
144strips all source routes out of addresses.
145.SH "SENDER ADDRESSES"
146.B qmail-inject
147looks 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
158If there is no
159.B From
160field,
161.B qmail-inject
162adds a new
163.B From
164field with the name of the user invoking
165.B qmail-inject.
166
167RFC 822 requires that certain sender fields contain
168only a single address, but
169.B qmail-inject
170does not enforce this restriction.
171.SH "RECIPIENT ADDRESSES"
172.B qmail-inject
173looks 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
182Every message must contain at least one
183.B To
184or
185.B Cc
186or
187.BR Bcc .
188.B qmail-inject
189deletes any
190.B Bcc
191field.
192If there is no
193.B To
194or
195.B Cc
196field,
197.B qmail-inject
198adds a line
199
200.EX
201 Cc: recipient list not shown: ;
202.EE
203
204This complies with RFC 822;
205it also works around some strange
206.B sendmail
207behavior, in case the message is passed through
208.B sendmail
209on another machine.
210.SH STAMPS
211Every message must contain a
212.B Date
213field, with the date in a strict format defined by RFC 822.
214If necessary
215.B qmail-inject
216creates a new
217.B Date
218field with the current date (in GMT).
219
220Every message should contain a
221.B Message-Id
222field.
223The field contents are a unique worldwide identifier for this message.
224If necessary
225.B qmail-inject
226creates a new
227.B Message-Id
228field.
229
230Another important field is
231.BR Received .
232Every time the message is sent from one system to another,
233a new
234.B Received
235field is added to the top of the message.
236.B qmail-inject
237does not create any
238.B Received
239fields.
240.SH "RESENT MESSAGES"
241A message is
242.I forwarded
243if 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
253If a message is forwarded,
254.B qmail-inject
255changes its behavior as follows.
256
257It deletes any
258.B Resent-Bcc
259field (as well as any
260.B Bcc
261field);
262if there are no
263.B Resent-To
264or
265.B Resent-Cc
266fields,
267.B qmail-inject
268adds an appropriate
269.B Resent-Cc
270line.
271It does
272.I not
273add a
274.B Cc
275line,
276even if neither
277.B To
278nor
279.B Cc
280is present.
281
282If there is no
283.B Resent-From
284field,
285.B qmail-inject
286adds a new
287.B Resent-From
288field.
289It does
290.I not
291add a new
292.B From
293field.
294
295.B qmail-inject
296adds
297.B Resent-Date
298if one is not already present;
299same for
300.BR Resent-Message-Id .
301It does
302.I not
303add new
304.B Date
305or
306.B Message-Id
307fields.
308.SH "OTHER FEATURES"
309Addresses are separated by commas, not spaces.
310When
311.B qmail-inject
312sees an illegal space,
313it inserts a comma:
314
315.EX
316 djb fred -> djb, fred
317.EE
318
319.B qmail-inject
320removes all
321.B Return-Path
322header fields.
323
324.B qmail-inject
325also removes any
326.B Content-Length
327fields.
328.SH "SEE ALSO"
329addresses(5),
330envelopes(5),
331qmail-inject(8)