Sortbay E-mail Thread Grouper
Group an mbox into conversations by Message-ID, In-Reply-To and References, like a mail program.
How it works
Sorts the messages of an mbox file (or several pasted .eml sources) into conversations: replies are linked through Message-ID, In-Reply-To and References, missing parents still connect their replies, and messages without those headers join a thread only when the subject matches after removing Re:/Fwd:/AW:/WG: prefixes and they share a participant.
- Union-find over Message-ID ↔ In-Reply-To/References (RFC 5322 §3.6.4); a reference to a message that is not in the file still links every message that names it.
- Messages without header links are merged by normalised subject only when one of them is a reply/forward (Re:, Fwd:, AW:, WG:, SV:, Antw:, Tr: … and [list] tags removed) and they share an address — so unrelated mails with the same subject stay apart.
- Threads are sorted newest first by their latest message; messages inside a thread by date. Thread ids are a stable hash of the first message.
Sources
Part of Sortbay
-
Sortbay Shared team inbox & notifications
One inbox for your team’s mail, forms and mentions: assign, label, snooze and follow up.
How to use the Sortbay E-mail Thread Grouper
Sort the messages of an mbox file into conversations by Message-ID, In-Reply-To and References, the way a mail program does.
What it is for
An exported mailbox is one long list of messages. Before you can answer a customer, count support cases or archive a project, you need to know which mails belong together. This tool reads an .mbox file (or several pasted .eml sources) and groups the messages into conversations. It follows the same headers a mail program uses: every message has a Message-ID, and a reply names its parent in In-Reply-To and References. For mails without those headers it falls back to the subject, carefully. The result lists every conversation with its messages, participants and the time of the last message.
Worked example
The first example is a small support mailbox with three messages. The summary: 3 messages form 2 conversations; 1 has more than one message.
- “Can't log in after the update” holds 2 messages: Maria Lopez's question and the reply from support@example.org. Linked by says headers, because the reply names the first mail in In-Reply-To.
- “Quote for 40 seats?” from Priya Natarajan stands alone (single), with priya@shop.example, sales@example.org and tom@shop.example as participants.
The conversations are sorted newest first by their last message, so the quote request (1 December, 08:35) comes before the login thread (30 November, 10:40).
The second example has a reply without In-Reply-To or References. The subject “Re: Can't log in after the update” matches the original once “Re:” is removed, and both mails share the address support@example.org, so they join one conversation with Linked by: subject.
The third example shows the safety side: a lone reply whose original is not in the file and a quote request with a different subject stay two separate conversations.
How to read the result
- Messages is the number of mails in the conversation; Participants lists every sender and recipient address once.
- Last message (UTC) is the newest Date header, converted to UTC.
- Linked by: headers (Message-ID chain), subject (fallback), single (nothing to link).
- Messages per conversation lists the mails in date order with their number in the file and the sender.
- A reply whose parent is missing from the file still connects to other replies that name the same parent.
Tips and common mistakes
- Export whole folders, including your sent mail, as .mbox. Without your own replies a conversation looks like several unanswered questions.
- Subject matching only joins a mail that is a reply or forward (Re:, Fwd:, AW:, WG:, SV:, Antw:, Tr:) with a mail that shares an address. Two newsletters called “Weekly update” stay apart.
- Mailing list tags such as “[team]” are ignored when subjects are compared.
- Messages are never changed or merged; the tool only groups them.
- Sortbay uses the same grouping when you import mail into a shared inbox, and its Rules tab lists the conversations found in the imported mail.
FAQ
Why are two mails with the same subject in separate conversations?
Neither is a reply or forward, or they share no address. That keeps unrelated mails with common subjects apart.
Does it read my mail on a server?
The tool page sends the text to our server to compute the result and does not store it. In the Sortbay app, files are read in your browser.
How many messages can it handle?
Up to 500 messages and 10 MB per file; the result says when a file was cut.
Can it group Outlook .msg files?
No. Save messages as .eml or export the folder as .mbox first.
Guide last updated:
For scripts and AI agents
- JSON API:
POST https://sortbaythreadgroup.usefulweb.site/api/v1/calculate(same calculation as this page) - Interface description: OpenAPI 3.1 · AI guide: llms.txt
- MCP server (Streamable HTTP):
https://sortbaythreadgroup.usefulweb.site/mcp· tool namesortbay_thread_group
Example request
curl -s -X POST https://sortbaythreadgroup.usefulweb.site/api/v1/calculate \
-H 'content-type: application/json' \
-d '{}'