New guide: how to warm up a dedicated IP without hurting your reputation. Read now →
Log in
MigoSMTP
SMTP and APIUpdated 26 Oct 2026

Email Threading: How Message-ID, In-Reply-To and References Keep Conversations Together

How Gmail, Outlook and Apple Mail group messages into conversations: Message-ID, In-Reply-To, References, subject matching, how to make application emails thread or not thread, and fixes for broken threads.

KM
Written by Kwame Mensah
Billing and Account Specialist
Reviewed by Ethan Brooks
  • Published21 Sep 2025
  • Read time6 min
  • Length1,220 words
Share this guide

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.

Message-IDA unique identifier for each message, created by the sender
In-Reply-ToThe Message-ID of the message being answered
ReferencesThe chain of Message-IDs in the conversation, oldest first
ClientsGmail also uses the subject; Outlook and Apple Mail rely more on headers and subject prefixes

The headers that define a thread

Message-ID: <[email protected]>
In-Reply-To: <[email protected]>
References: <[email protected]> <[email protected]>
  • Message-ID uniquely identifies the message and must be globally unique, normally with a domain you control after the @.
  • In-Reply-To holds the Message-ID of the direct parent.
  • References lists 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

ClientMain signalsSubject roleNotes
GmailReferences and In-Reply-To, plus a matching subjectRequired: if the subject differs, messages usually split even with correct headersStrips "Re:" and "Fwd:" prefixes for comparison
Outlook (desktop)Conversation index headers and References/In-Reply-ToNormalised subject helpsExchange adds its own Thread-Index
Outlook.com and Microsoft 365 webHeaders and subjectModerateSettings let users turn conversation view off
Apple MailReferences and In-Reply-ToLowCan group by subject if headers are missing
Many mobile clientsFollow the server or the headersVariesTest 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

  1. 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.
  2. Reply with headers. For the second message, set In-Reply-To to the previous message's ID and References to the whole chain, or at least the root and the parent.
  3. Keep the subject stable. Use the same base subject and add "Re: " only if you wish. Avoid adding timestamps or counters.
  4. 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.
  5. Keep the same From address and sender name in a thread. Changes can confuse readers and some clients.
  6. 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

SymptomLikely causeFix
Replies appear as new conversations in GmailSubject changed, or References missingKeep the subject; set In-Reply-To and References
Different tickets mergeSame subject across tickets and Gmail groupingInclude the ticket ID in the subject, consistently
Provider overwrote Message-IDAPI or relay generates its own headerRead the final ID from logs or response, and store it
Chain breaks after the fifth replyReferences truncated or not appendedAppend every ID; keep root and recent entries
Outlook shows two threadsThread-Index differsRely on standard headers; test Exchange behaviour
Duplicates after retryTwo sends with different IDsUse 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.

Explore the email API

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.

Topics#threading#message-id#in-reply-to#references#headers
Was this guide helpful?Your answer helps us improve our documentation.

Start sending in minutes.

Create an account, add your domain and send your first email.

Get started Talk to sales