← RFC Reference

RFC 5322 – Internet Message Format

Current Standard Core SMTP & Message Format Obsoletes RFC 2822 Published October 2008
ELI5: If RFC 5321 (SMTP) is the postal truck that carries your letter, RFC 5322 is the format of the letter itself — where you write the return address, the recipient address, the date, the subject line, and then the actual message below. Every email you open in your inbox is structured according to this spec.

Why This RFC Exists

RFC 5322 defines the syntax of an email message — the text that flows through SMTP during the DATA phase. Its ancestor, RFC 822 (1982), was one of the earliest internet standards. RFC 5322 updated the format with stricter syntax rules, clearer obsolete-syntax handling, and alignment with modern practices.

This RFC is purely about the message format — it says nothing about how the message gets transported (that's RFC 5321) or how attachments work (that's RFC 2045 and the MIME family). It defines the header fields, the body, and the rules for addresses, dates, and message identification.

How It Works

An email message is divided into two parts separated by a blank line:

  1. Header section: A sequence of header fields, each as Name: value, terminated by CRLF.
  2. Body: The message content, which is simply unstructured text (MIME adds structure on top).

Message Structure

# Header section From: Alice Smith <alice@example.com> To: Bob Jones <bob@example.net>, Carol White <carol@example.org> Cc: Dave <dave@example.com> Subject: Quarterly Report Date: Wed, 11 Mar 2026 15:30:00 -0500 Message-ID: <unique-id-12345@example.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" # Blank line separates headers from body Hi Bob and Carol, Please find the quarterly report attached.

Required Header Fields

RFC 5322 mandates that every message MUST contain these fields:

Field Description Example
From: The author(s) of the message From: Alice <alice@example.com>
Date: When the message was composed Date: Wed, 11 Mar 2026 15:30:00 -0500

Additionally, every message SHOULD contain a Message-ID field — a globally unique identifier. Messages without a Message-ID cause problems with threading, deduplication, and DKIM signing.

Common Header Fields

Field Purpose
To: Primary recipients
Cc: Carbon-copy recipients
Bcc: Blind carbon-copy (removed before delivery)
Subject: Topic of the message
Reply-To: Address for replies (overrides From:)
Sender: Actual sender when From: contains multiple authors or differs from the transmitting agent
In-Reply-To: Message-ID of the message being replied to
References: Chain of Message-IDs for threading
Message-ID: Globally unique identifier for this message
Return-Path: Added by the final delivery system from MAIL FROM
Received: Trace header added by each server that handles the message

Key Technical Details

Address Formats

RFC 5322 defines two valid address formats:

Display names containing special characters must be quoted: "O'Brien, Alice" <alice@example.com>. The local-part (before the @) is case-sensitive per spec but treated as case-insensitive by virtually all mail systems in practice.

Date Format

The date format is specific and unforgiving:

Date: Thu, 11 Mar 2026 15:30:00 -0500

The format is: day-of-week, DD Mon YYYY HH:MM:SS zone. The day-of-week is optional but conventional. The timezone must be a numeric offset (-0500), not a name like "EST". While the spec tolerates old timezone abbreviations as obsolete syntax, generating them is not recommended.

Message-ID Format

A Message-ID must be globally unique and follows the form:

Message-ID: <unique-part@domain>

Best practice is to use a UUID or timestamp-based unique part combined with your sending domain: <20260311153000.a1b2c3@mail.example.com>.

Header Folding

Long header values can be "folded" by inserting a CRLF followed by at least one space or tab (whitespace). This is how long recipient lists or subject lines stay within the 998-character line limit:

To: Alice <alice@example.com>, Bob <bob@example.com>, Carol <carol@example.com>

Parsers must "unfold" these by joining lines where the continuation starts with whitespace.

Trace Headers

Each mail server that handles a message prepends a Received: header. These form a top-to-bottom trail — the topmost Received: header was added last. The Return-Path: header is added only by the final delivery system and contains the envelope sender from MAIL FROM.

Common Mistakes

Deliverability Impact

Related RFCs