EML-1Required
Send the headers every message needs
Give every message exactly one From, To, Subject, Date and Message-ID, in the format RFC 5322 sets out.
How to do it
Let your mail library build the headers instead of writing them by hand. From names one mailbox on a domain you control. Date uses the RFC 5322 format with a time zone. Message-ID is globally unique, such as a random value at your own domain. RFC 5322 requires only From and Date. Gmail's sender rules also ask for a valid Message-ID and single copies of From, To, Subject and Date. Gmail may reject mail that breaks them. They are part of Meet the bulk sender rules. Strip line breaks from any input you put in a header, as Strip line breaks from headers and logs says.
Examples
Plain text example
From: Example Shop <orders@example.com>
To: Ada Lovelace <ada@example.org>
Subject: Your order 1042 has shipped
Date: Tue, 20 Oct 2026 09:30:00 +0200
Message-ID: <7f3c9a2e-4b1d-4e8a-9c0f-1a2b3c4d5e6f@example.com>
Python example
from email.message import EmailMessage
from email.utils import formatdate, make_msgid
msg = EmailMessage()
msg["From"] = "Example Shop <orders@example.com>"
msg["To"] = "ada@example.org"
msg["Subject"] = "Your order 1042 has shipped"
msg["Date"] = formatdate(localtime=True)
msg["Message-ID"] = make_msgid(domain="example.com")
JavaScript example
import { randomUUID } from 'node:crypto';
await transporter.sendMail({
from: 'Example Shop <orders@example.com>',
to: 'ada@example.org',
subject: 'Your order 1042 has shipped',
date: new Date(),
messageId: `<${randomUUID()}@example.com>`,
});
How to check
Open a test message with "show original". From, Date, Message-ID, Subject and To each appear exactly once, and the Message-ID ends in your own domain.
Sources
Related rules
- EML-18 Meet the bulk sender rules in Email
- APS-6 Strip line breaks from headers and logs in Application security
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/email/message-basics/required-headers">Agent Wranglers email playbook</a>. In code you write, add a comment next to it with the same link.