# Sortbay E-mail Thread Grouper > Group an mbox into conversations by Message-ID, In-Reply-To and References, like a mail program. 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. Part of usefulweb.site (https://usefulweb.site/). Part of [Sortbay](https://sortbay.usefulweb.site/) (ownerApp: sortbay). Results are deterministic calculations from the inputs and the listed assumptions; the API returns exactly what the web page shows. ## Use it - Human interface: https://sortbaythreadgroup.usefulweb.site/ (interactive tool at https://sortbaythreadgroup.usefulweb.site/tool) - JSON API: POST https://sortbaythreadgroup.usefulweb.site/api/v1/calculate with a JSON object of inputs (schema: https://sortbaythreadgroup.usefulweb.site/api/v1/tool) - OpenAPI: https://sortbaythreadgroup.usefulweb.site/openapi.json - MCP (Streamable HTTP): https://sortbaythreadgroup.usefulweb.site/mcp - tool `sortbay_thread_group` ## Inputs - source (textarea): E-mail source (.eml text) or mbox - Paste the full source of a message (headers, a blank line, then the body) — in most mail programs “Show original” or “View source”. Several messages: paste an mbox (each starts with a “From ” line). - file (file): E-mail file (.eml or .mbox, optional) - Up to 10 MB. Used instead of the pasted text when given. Export single mails as .eml or a folder as .mbox from your mail program. ## Method - 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.