A line is a string of zero or more bytes. A line is empty if it contains zero bytes. Every line in a header contains one or more bytes.
A field is a sequence of one or more nonempty lines. The first line does not begin with space or tab. Subsequent lines, if there are any, each begin with space or tab. Each field includes a name and a value.
For example, the following header contains five fields:
Received: (qmail-queue invoked by uid 666);
30 Jul 1996 11:54:54 -0000
From: "D. J. Bernstein" <djb@silverton.berkeley.edu>
To: fred@silverton.berkeley.edu
Date: 30 Jul 1996 11:54:54 -0000
Subject: Go, Bears!
The first field contains two lines:
Received: (qmail-queue invoked by uid 666);
30 Jul 1996 11:54:54 -0000
Note on terminology: some people refer to fields as ``headers.''
However, 822 requires that each byte in a header line be between 0 and 127 inclusive. Furthermore, sendmail gets rather confused by bytes between 128 and 159; it uses them for internal macro handling.
UNIX mail programs store headers as UNIX text files, so the byte \012 cannot appear anywhere inside a line. If a message with a bare \012 is transmitted through sendmail, the \012 will be treated as a line ending; if a message with a bare \012 is given to qmail, the message will be rejected. 822bis prohibits \012.
sendmail corrupts any \0 in a message header. Some mailers truncate lines at \0. 822bis prohibits \0.
822bis also prohibits \015. 822 also discouraged tabs, and prohibited one use of backspaces.
Received:
from [censored] by pinerolo.piw.it
with smtp
(Linux Smail3.1.28.1 #5)
id m0uqMBq-000BzwC; Tue, 13 Aug 96 17:19 GMT+0100
There are three popular strategies for detecting the end of the header: