Some Notes on Headers

Headers are name-value pairs, separated by a colon (:). Header names are case insensitive, but some of their values are case sensitive. Within email addresses particularly, the local part of the email address must generally preserve case. An exception to this is the special address of “Postmaster,” which must be legal in any combination of case. See Chapter 9 for more information on the Postmaster address.

Note

Be aware that there is no agreed definition of how a horizontal tab character should work. Some systems treat a tab as a number of spaces, others as a special character, etc. For this reason, tabs should never be used in mail headers. Similarly, since one cannot tell in advance how tabs will appear in mail-reading software, they should be used with caution elsewhere in mail messages.

Long headers

Headers are normally represented as a header name (e.g., To), followed by a colon (:), followed by the value, or body. In some cases, such as for the Comments Received headers that might be very long, the header values can be “folded” onto multiple lines.

A long header value can be sent by an MUA (or by speaking SMTP directly to an MTA) in one of two ways: a single long line of ASCII characters can be sent, or the line can be folded. If a Single long line is sent, it should probably not exceed 256 characters. If the long line is folded, the number of characters per line should probably not exceed 72.

A long line is folded by breaking the line into smaller lines, each ...

Get Programming Internet Email now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.