D. J. Bernstein
Internet mail

Internet mail message header format

Field names and field values
Tokenizable field values
Address lists

Recipients: To, Cc, Bcc
Senders: From, Sender
Response targets: Reply-To, Mail-Reply-To, Mail-Followup-To
Threading: Message-ID, References, In-Reply-To

Date fields
Resent-* fields
Envelope information: Return-Path, Received
Miscellaneous: Subject, Comments, Keywords, Encrypted

Field name index

These pages are designed to be a complete, correct, comprehensible reference for the format of an Internet mail message header. They explain
  1. what shows up in today's Internet mail messages;
  2. what today's mail-reading programs can handle; and
  3. what the IETF header-format specifications say.
There are several IETF header-format specifications:
  1. RFC 822, published in 1982. This was the primary specification for many years. The header format is often called ``822 format.'' However, most implementors don't know what 822 says. 822 allows much more flexibility than a typical mail-reading program can actually handle; meanwhile it imposes restrictions that millions of users violate every day.
  2. RFC 1123, published in 1989. A few corrections to 822.
  3. RFC 2822, published in 2001, also known as 822bis. Replaced 822/1123. 822bis is more misleading than 822 in some areas, less misleading in others.

A warning about evolution

It's easy to add syntax to a protocol. First upgrade all the readers to understand the syntax; then the writers can safely start using it.

For most protocols, it's just as easy to remove syntax. First upgrade all the writers to avoid the syntax; then the readers can safely stop supporting it.

Mail is different. A mail message lasts forever. Millions of people have saved billions of messages; and they expect every new MUA to be able to parse every one of those messages. Tomorrow's readers have to be compatible with yesterday's writers.

If you're a new implementor, you'll be shocked at how badly 822 was designed. Extracting even the simplest information from a message---the author's address, for example, or the sending date---is excruciatingly painful. And I see no sign that we'll ever be rid of the horrors of 822 syntax; how can we convince users to convert their old mailboxes to a sensible new format?