Email Threading
Email threading groups related messages into a conversation. Mail clients decide what belongs together from the Message-ID, In-Reply-To, and References headers, and some mail servers additionally assign a thread identifier that EmailEngine exposes as threadId. This page is the entry point; the four pages under it each own one part of the subject.
Quick Start
Use the reference field of the submit API and EmailEngine sets In-Reply-To and References from the referenced message:
curl -XPOST "https://emailengine.example.com/v1/account/example/submit" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"reference": {
"message": "AAAADQAABl0",
"action": "reply"
},
"html": "<p>Your reply</p>"
}'
That covers replies and forwards to a message EmailEngine can already see. A sequence that starts with no stored message to reference has to carry its own messageId and threading headers; Sending threaded messages walks through one.
Threading Documentation
1. Threading Overview
The fundamentals:
- What
Message-ID,In-Reply-To, andReferencesdo - Why the subject line matters
- Which backends assign a
threadId, and what one looks like per provider - Where
threadIdappears in API responses and webhook payloads
2. Provider-Specific Threading
How each backend behaves:
- Gmail over IMAP and the Gmail API: thread IDs and the
\Allfolder - Microsoft 365 over the Graph API: conversation IDs and the
\Allfolder - Microsoft 365 over IMAP: no thread IDs
- Yahoo, AOL, and other OBJECTID servers: thread IDs, but no
\Allfolder - Other IMAP servers: no thread IDs
3. Searching Thread Messages
Retrieving every message in a conversation:
- One search against
\Allwhere the backend has it - One search per folder where it does not
- Building a thread from headers when the server assigns no
threadId
4. Sending Threaded Messages
Keeping a sequence you send in one conversation:
- Setting
messageIdand extendingReferenceswith each message - When to use
referenceinstead - Detecting a
Message-IDthe receiving server rewrote
See Also
- Replies and forwards - Letting EmailEngine build the threading headers for you
- Searching messages - The search terms the thread queries are built from
- Message IDs - What a
threadIdis, and why it is not portable between providers - Messages API - Where
threadIdappears in a message payload