# Sortbay E-mail (.eml/.mbox) to JSON > Read an .eml or .mbox file: sender, recipients, date, subject, clean text and attachment list. Parses e-mail source the way a mail program would — RFC 5322 headers, MIME multipart, quoted-printable and base64, encoded subjects and file names in any charset, mbox archives — and returns each message as JSON: sender, recipients, date in UTC, subject, the readable text (HTML mail reduced to safe plain text), threading ids and the attachments by name, type and size. Attachment contents are never extracted or stored. Part of usefulweb.app (https://usefulweb.app/). Part of [Sortbay](https://sortbay.usefulweb.app/) (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://sortbayemailparse.usefulweb.app/ (interactive tool at https://sortbayemailparse.usefulweb.app/tool) - JSON API: POST https://sortbayemailparse.usefulweb.app/api/v1/calculate with a JSON object of inputs (schema: https://sortbayemailparse.usefulweb.app/api/v1/tool) - OpenAPI: https://sortbayemailparse.usefulweb.app/openapi.json - MCP (Streamable HTTP): https://sortbayemailparse.usefulweb.app/mcp - tool `sortbay_email_parse` ## 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. - includeHeaders (boolean): Include every header line in the result ## Method - Headers are unfolded (RFC 5322 §2.2.3), encoded words like =?UTF-8?B?…?= and =?ISO-8859-1?Q?…?= are decoded (RFC 2047), file names with RFC 2231 continuations and charsets are joined; raw 8-bit headers are read as UTF-8, else Windows-1252. - Bodies: base64 and quoted-printable are decoded and the declared charset is applied; multipart/alternative prefers the plain-text part; an HTML-only mail is reduced to plain text (scripts, styles and comments removed, all tags dropped, links kept as “text (url)” for http(s) and mailto only, entities decoded). - Attachments (including inline images and forwarded messages) are listed with name, type and decoded size; their content is not returned. Forwarded messages (message/rfc822) are also quoted into the text. - Dates are converted to UTC from the numeric offset or the obsolete zone names (GMT, EST, PDT …). mbox files split on “From ” lines after an empty line (RFC 4155) and “>From ” escapes are undone. Limits: 500 messages, 200 MIME parts and 8 nesting levels per message, 100 000 characters of text.