Sending multiple emails in the same thread with EmailEngine
Keep your follow‑up emails in the same conversation by generating your own Message‑ID values and building the References header.

TL;DR
CallPOST /v1/account/:id/submit
with your ownmessageId
and a growingreferences
header to force every follow‑up into the same email thread.
Why it matters
Email clients rely on the RFC 5322 Message‑ID
and References
headers—never on SMTP commands—to decide which messages belong together. If you let EmailEngine autogenerate those values, your perfectly timed sequence may scatter across the inbox. By controlling them yourself, every follow‑up lands exactly where the user expects.
Step‑by‑step
1. Send the initial message
$ curl -XPOST "http://127.0.0.1:3000/v1/account/demo/submit" \
-H "Authorization: Bearer $EE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"from": { "address": "[email protected]" },
"to": { "address": "[email protected]" },
"subject": "Test message thread",
"html": "<p>First message in thread!</p>",
"messageId": "<[email protected]>"
}'
Save the messageId
value—you’ll need it for every reply.
2. Add the first follow‑up
$ curl -XPOST "http://127.0.0.1:3000/v1/account/demo/submit" \
-H "Authorization: Bearer $EE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"from": { "address": "[email protected]" },
"to": { "address": "[email protected]" },
"subject": "Test message thread",
"html": "<p>Second message in thread!</p>",
"messageId": "<[email protected]>",
"headers": {
"references": "<[email protected]>"
}
}'
3. Keep extending references
Each subsequent call appends the current message’s ID:
"headers": {
"references": "<[email protected]> <[email protected]>"
}
Common pitfalls
⚠️ Missing angle brackets – Wrap every ID in < >
or some clients ignore the header.
💡 Subject drift – Changing the subject (beyond adding Re:) breaks the thread despite perfect headers.
🚧 Gmail limit – Gmail reads only the last 20 References
entries. If your sequence is longer, drop the oldest IDs.
🗄️ ID storage – Persist every generatedmessageId
so you can rebuild thereferences
header later; EmailEngine doesn’t store that list for you.