An .eml file is one message in the Internet Message Format,
RFC 5322, usually with
MIME structure in the body. This page covers the
header and follows RFC 5322, with
RFC 5321 for the trace fields,
RFC 6532 and RFC 2047, all read
2026-11-12.
Lines and folding
- Lines end with CR LF. A line must be at most 998 characters and should be at most 78, not counting the CR LF.
- The header is a list of fields,
Name: value. Names are printable US-ASCII (33 to 126) without a colon. The names the RFC defines are ABNF strings, which match in either case. - A field can be folded: a CR LF may be put before any space or tab in the value, and the line that follows starts with that white space. Unfolding removes the CR LF.
- An empty line ends the header; everything after it is the body. Header text is US-ASCII; RFC 6532 allows UTF-8 in messages sent with the SMTPUTF8 extension.
Fields
| Field | Times | Meaning |
|---|---|---|
Date | 1, required | When the message was written; see dates. |
From | 1, required | The author or authors (a list of mailboxes). |
Sender | 0 or 1 | The one mailbox that sent it, required when From lists several. |
Reply-To | 0 or 1 | Where replies should go. |
To, Cc | 0 or 1 each | Primary and copied recipients. |
Bcc | 0 or 1 | Blind copies. The RFC gives three uses: the line is removed for every recipient; or kept only in a separate copy for the blind recipients; or sent empty to show that blind copies went to someone. Which is used depends on the program. |
Message-ID | 0 or 1 (should) | A unique ID: <left@right>. |
In-Reply-To | 0 or 1 (should, in some replies) | Message IDs of the message or messages replied to. |
References | 0 or 1 (should, in some replies) | Message IDs of the thread. |
Subject | 0 or 1 | Text. |
Comments | any | Text. |
Keywords | any | Comma-separated phrases. |
Resent-Date, Resent-From, Resent-Sender, Resent-To, Resent-Cc, Resent-Bcc, Resent-Message-ID | blocks | Added when a message is re-sent; each re-send adds a block at the top. Resent-Date is required in a block with other resent fields, and Resent-Sender when Resent-From has several addresses. |
Return-Path | trace, 0 or 1 | Inserted by the SMTP server that makes final delivery (RFC 5321): the envelope sender from the MAIL command, <address> or <>. |
Received | trace, 1 or more per block | Each SMTP server prepends one, so the newest is first. RFC 5321 gives the form FROM … BY …, then optional VIA, WITH, ID and FOR parts, then ; and a date. |
| Other fields | any | Any other name is allowed if it is not one of the names above; the value is unstructured text. MIME-Version and the Content- fields of MIME are such fields, defined in RFC 2045. |
Dates
[day-of-week ","] day month year hour ":" minute [":" second] zone,
such as Thu, 12 Nov 2026 21:30:00 +0000. Day names are Mon
to Sun, months Jan to Dec, the zone is
+hhmm or -hhmm. -0000 means the local zone is
unknown. Readers also accept obsolete forms: two-digit years and zone names such as
GMT, EST and PDT.
Addresses
- A mailbox is
local-part@domain, optionally with a display name:Alice Example <alice@example.com>. A display name with special characters is put in double quotes. - A group is
name: mailbox, mailbox;, possibly empty (undisclosed-recipients:;). - Text in parentheses is a comment and may appear between most tokens.
Encoded words
RFC 2047 lets unstructured text
(such as Subject) and display names carry other characters:
=?charset?encoding?text?=, at most 75 characters. Encoding
B is base64; Q is like quoted-printable, with
_ for a space. Adjacent encoded words separated only by white space are
joined without the space. Example:
Subject: =?UTF-8?B?Q2Fmw6k=?= is “Café”.