Sortbay E-mail (.eml/.mbox) to JSON

Read an .eml or .mbox file: sender, recipients, date, subject, clean text and attachment list.

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).

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.

When you run the tool, this file is uploaded to our server, processed and then deleted. The files the tool creates stay on our server for about 2 hours: download them to keep them, or save them to your Google Drive.

Try an example: · ·

More about this tool

Part of Sortbay

How it works

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.

  • 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.

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.

    Open Sortbay

How to use the Sortbay E-mail (.eml/.mbox) to JSON converter

Turn a saved e-mail or a whole mbox folder into readable fields and clean JSON, with decoded subjects, plain text and a list of attachments.

What it is for

A saved e-mail is hard to read as a file. Subjects arrive as encoded words like =?UTF-8?B?…?=, the text is often base64 or quoted-printable, and HTML-only newsletters hide the message between tags. This converter reads one message (an .eml file or pasted source from “Show original”) or a whole mailbox exported as .mbox, and returns sender, recipients, date, subject, Message-ID, the readable text and the attachments as a table and as JSON. Use it to check what a mail really contains, to feed mail into a script or a spreadsheet, or to see why a mail program shows odd characters.

Worked example

The first example is an invoice mail with a German subject and a PDF. The summary names the sender Jürgen Müller (buchhaltung@example.de), the subject “Rechnung Nr. 2026-118 – bitte prüfen”, the time 2026-12-01 08:03 UTC and 1 attachment. The umlauts and the dash come from an encoded subject; the text starts with “Guten Tag, anbei die Rechnung für November”. The attachments table lists Rechnung-2026-118.pdf, application/pdf, 1 KB.

The second example is an HTML-only booking confirmation in base64. Text from shows HTML (converted to text): the heading becomes “Booking confirmed”, list items become bullets (“• Time: 10:00”, “• Room: B2”), and the link keeps its address in brackets so you can see where it points.

The third example is an mbox file with three messages: two from Maria Lopez about a login problem (the second is the “Re:” reply) and a quote request from Priya Natarajan. The summary says 3 messages in the mbox file, 0 attachments in total, and the table gives one row per message.

How to read the result

  • Date (UTC) is the Date header converted to UTC, so messages from different time zones sort correctly.
  • Text from tells you which part was used: the plain-text part, or HTML converted to text when there is no plain part.
  • Attachments lists file name, type and size only. The content is never shown or returned, so nothing in an attachment can run.
  • The JSON has one object per message with from, to, cc, subject, date, messageId, inReplyTo, references, text and attachments. With Include every header line in the result you also get all raw headers, for example to check Received lines.

Tips and common mistakes

  • Paste the complete source: headers, one empty line, then the body. A body without headers is read as a message without sender or subject.
  • In an mbox file every message starts with a line beginning with “From ” (with a space). Text lines that start the same way are escaped by mail programs and read correctly.
  • Scripts, styles, images and tracking pixels of HTML mail are dropped. Links stay visible as text with their address, never as clickable HTML.
  • Unknown character sets fall back to UTF-8 or Windows-1252, so a rare charset can show a few wrong letters.
  • Sortbay uses the same parser when you import mail into a shared inbox, so what you see here is what an imported item will show.

FAQ

Is my mail uploaded somewhere?

The tool page sends the text to our server to compute the result and does not store it. In the Sortbay app, imported files are read in your browser and never uploaded.

Can it read attachments?

It lists them with name, type and size. It does not open or convert their content.

How big can a file be?

Up to 10 MB per file. Very large mailboxes are cut after the message limit and the result says so.

Does it support Outlook .msg files?

No. Save the message as .eml, or export the folder as .mbox from a mail program such as Thunderbird.

Guide last updated:

For scripts and AI agents

  • JSON API: POST https://sortbayemailparse.usefulweb.app/api/v1/calculate (same calculation as this page)
  • Interface description: OpenAPI 3.1 · AI guide: llms.txt
  • MCP server (Streamable HTTP): https://sortbayemailparse.usefulweb.app/mcp · tool name sortbay_email_parse
Example request
curl -s -X POST https://sortbayemailparse.usefulweb.app/api/v1/calculate \
  -H 'content-type: application/json' \
  -d '{…see OpenAPI examples…}'
Feedback · ideas & bug reports welcome