Reading — step 1 of 5
Read
~1 min readSMTP Basics
Email Headers & MIME
After DATA, the client sends:
From: Alice <[email protected]>
To: [email protected]
Subject: Hello
Date: Mon, 13 May 2024 10:30:00 +0000
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Body text...
Headers + blank line + body. RFC 5322 defines the format.
Multi-part messages use MIME (RFC 2045-2049):
From: [email protected]
To: [email protected]
Subject: Multi-part
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----abc123"
------abc123
Content-Type: text/plain
Plain text version
------abc123
Content-Type: text/html
<p>HTML version</p>
------abc123
Content-Type: image/png; name=photo.png
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=photo.png
iVBORw0KGgoAAAANSUhEUgAA...
------abc123--
Boundary string separates parts. Each part has its own headers.
Common header types:
- Mailbox:
From,To,Cc,Bcc,Reply-To. Comma-separated lists. - Identification:
Message-ID,In-Reply-To,References(for threading). - Trace:
Received(one per hop). Multiple, top-to-bottom most-recent first. - Resent-*: forwarded mail trail.
Encoding:
- ASCII-only originally.
- Non-ASCII via Quoted-Printable or Base64 in body (Content-Transfer-Encoding header).
- Subject with non-ASCII: encoded via RFC 2047 (
=?utf-8?B?...?=).
Threading via Message-ID + References + In-Reply-To: clients build conversation trees.
Bounce messages: Delivery Status Notifications (DSN, RFC 3464). Returned to MAIL FROM address with structured failure info.
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…