Conversation view groups related messages into one thread, and users have strong opinions about it. A support system whose replies appear as separate emails frustrates customers; a notification system whose daily alerts collapse into one endless conversation hides important messages. Threading is not magic. Mail clients use header fields, and sometimes the subject, to decide which messages belong together, and the rules differ slightly between providers. This guide explains the three headers that matter, how major clients decide, how to build threads on purpose for ticket and comment flows, how to prevent threading where it does not help, and how to diagnose threads that split or merge unexpectedly. It builds on the explanation of Message-ID.
The headers that define a thread
Message-ID: <[email protected]>
In-Reply-To: <[email protected]>
References: <[email protected]> <[email protected]>Message-IDuniquely identifies the message and must be globally unique, normally with a domain you control after the@.In-Reply-Toholds the Message-ID of the direct parent.Referenceslists ancestors, starting with the thread root and ending with the parent. When a long chain grows, implementations keep the root and the most recent entries.
A reply made by a mail client sets these automatically. An application that sends follow-ups must set them itself and must store the Message-ID of each outbound message so later messages can refer to it. See reading headers.
How major clients thread
| Client | Main signals | Subject role | Notes |
|---|---|---|---|
| Gmail | References and In-Reply-To, plus a matching subject | Required: if the subject differs, messages usually split even with correct headers | Strips "Re:" and "Fwd:" prefixes for comparison |
| Outlook (desktop) | Conversation index headers and References/In-Reply-To | Normalised subject helps | Exchange adds its own Thread-Index |
| Outlook.com and Microsoft 365 web | Headers and subject | Moderate | Settings let users turn conversation view off |
| Apple Mail | References and In-Reply-To | Low | Can group by subject if headers are missing |
| Many mobile clients | Follow the server or the headers | Varies | Test your target clients |
In Gmail the practical rule is that threading needs both the headers and the same subject line. This surprises teams that add a ticket number to the subject of each reply, or that change the subject of an update. Changing the subject starts a new thread, even when the headers link it to the previous message.
Making an application thread correctly
- Generate and store Message-IDs. Set your own header on every outbound message (for example
<[email protected]>) and store it with the ticket or conversation. If your provider overrides the header, read the value from the send response or log, and store that. - Reply with headers. For the second message, set
In-Reply-Toto the previous message's ID andReferencesto the whole chain, or at least the root and the parent. - Keep the subject stable. Use the same base subject and add "Re: " only if you wish. Avoid adding timestamps or counters.
- Handle inbound replies. When a customer replies, their client sets In-Reply-To to your last message. Use that ID, or a plus-addressed Reply-To, to find the ticket. See plus addressing and Reply-To.
- Keep the same From address and sender name in a thread. Changes can confuse readers and some clients.
- Test with real accounts in Gmail and Outlook, sending three or four messages in sequence.
Preventing unwanted threading
Sometimes grouping is harmful: daily digests, password resets and security alerts should appear as separate messages. If the subject and sender are identical day after day, Gmail may group them. Options:
- Include distinguishing detail in the subject, such as the date or the event ("Sign-in from a new device on 21 Sep").
- Give every message a new unique Message-ID and omit In-Reply-To and References.
- Do not reuse a subject for different events.
- For time-sensitive messages, avoid patterns that hide them inside old conversations. See password reset and OTP emails.
Threads and deliverability
Threaded replies from a real customer conversation are positive engagement signals. Messages that continue an existing thread, where the recipient has replied before, are rarely filtered as spam. That does not mean you should fake threads: adding a forged "Re:" prefix or false In-Reply-To headers to a first message is a deceptive practice that filters and users dislike, and it can breach the law in some places. Use real references only. See content filters.
Forwarding, lists and gateways
- Forwarded messages usually keep the original Message-ID in the body but get a new one in the header.
- Mailing lists may add or rewrite subject prefixes and keep References, so threads often continue.
- Security gateways that rewrite messages should preserve headers, but some replace Message-ID, breaking a thread.
- Auto-replies must not interfere with threads or loops. See auto-replies and loops.
Notifications from collaboration tools
Comment and notification systems often face a design choice: one thread per item, or one message per event. Threading per item suits discussions, such as a document or ticket with many comments, because readers follow the story. A new message per event suits alerts, where each one needs attention. Many products let users choose. If you offer a choice, store a preference, use the same headers logic described above for the threaded mode and unique messages for the other. Also make sure that replying to a notification does what the user expects, whether that is posting a comment or reaching a person, and say so in the footer.
Troubleshooting split or merged threads
| Symptom | Likely cause | Fix |
|---|---|---|
| Replies appear as new conversations in Gmail | Subject changed, or References missing | Keep the subject; set In-Reply-To and References |
| Different tickets merge | Same subject across tickets and Gmail grouping | Include the ticket ID in the subject, consistently |
| Provider overwrote Message-ID | API or relay generates its own header | Read the final ID from logs or response, and store it |
| Chain breaks after the fifth reply | References truncated or not appended | Append every ID; keep root and recent entries |
| Outlook shows two threads | Thread-Index differs | Rely on standard headers; test Exchange behaviour |
| Duplicates after retry | Two sends with different IDs | Use idempotency. See idempotency patterns |
To debug, view the original source of two messages and compare Message-ID, In-Reply-To and References values. The parent's ID must appear exactly as sent, including the angle brackets. Use the logs to match IDs. See tracing messages.
A design pattern for support and comments
For a ticketing or comment system: create a root Message-ID when the thread begins, using a pattern that encodes the thread ID, for example <[email protected]>. For each later message, create a fresh ID such as <[email protected]>, set In-Reply-To to the last message in the thread and References to the root plus recent messages. On inbound mail, parse In-Reply-To and References for your domain's IDs and extract the thread number. This does not depend on the subject, survives clients that edit it, and works with plus-addressed Reply-To as a backup.
Threading rewards consistency. Stable subjects, honest headers and stored identifiers produce conversations that read well in every client, while careless patterns create splits and mysteries that are hard to explain to users.
Send threaded transactional mail Control headers and read delivery logs for each message.
References and further reading
Frequently asked questions
Which headers control email threading?
Message-ID, In-Reply-To and References, with the subject also used by Gmail.
Why do my replies create new conversations in Gmail?
Usually the subject changed or the In-Reply-To and References headers are missing or wrong.
How do I stop notifications from grouping?
Use distinctive subjects, new Message-IDs and no In-Reply-To or References.
Can I fake a reply to improve delivery?
No. Forged Re: prefixes or references are deceptive and can hurt trust and compliance.
What if my provider changes the Message-ID?
Read the final ID from the response or logs and store it for later replies.