Email parsing for developers

Email Parser API: An Email Parsing API That Turns Email Into Structured JSON

Turn email into structured JSON your code can use

MailParse parses email into clean JSON: upload an .eml or .msg file, paste raw email text, or connect a Gmail, Outlook, or IMAP mailbox for ongoing sync. Define the custom fields you want pulled from the body, and download structured JSON ready to load into a database or script. Paste a sample below to see the output shape.

Structured JSON output
Named custom fields from the body
Connected mailbox sync
No MIME parsing code to write

Last updated July 2026

Convert your email files
No install

Connect a mailbox to pull .eml/.msg in bulk, or paste a raw email to test the converter now.

or paste an email to test
Output format
Columns to extract
Extract your own custom fields
Popular:

Create a free account to download. No credit card required.

Quick answer

An email parser API decodes the MIME structure and returns the body, headers, and any custom fields you name as clean data. MailParse parses an uploaded .eml/.msg file or a connected Gmail, Outlook, or IMAP mailbox into JSON you can download and load into a database, script, or import tool. No manual copying and no brittle regex to maintain yourself.

JSON
Predictable parsed output
Mailbox sync
Gmail, Outlook & IMAP
Custom fields
Label matching or regex
No install
Runs in your browser

Plenty of business processes start with an email: a lead from a web form, an order confirmation from a marketplace, an invoice from a supplier, an alert from a monitoring tool. The data you need is sitting in that message, but raw email is messy. MIME parts, base64 encoding, inline images, and a dozen header formats stand between the message and a clean record your application can store. A dedicated email parser handles all of that for you and hands back predictable JSON.

MailParse decodes an uploaded .eml or .msg file, or mail synced from a connected Gmail, Outlook, or IMAP mailbox, into a consistent structure: sender, recipients, subject, plain text and HTML bodies, all headers, and a list of attachments by filename, type, and size. You define the custom fields you want pulled from the body, such as an order ID or invoice total, using label matching or a regex pattern, and MailParse returns them alongside the standard fields. Download the result as JSON and load it into your database, script, or import tool. If you are currently weighing provider-hosted inbound routes, we have written up the SendGrid Inbound Parse webhook and Amazon SES inbound email parsing in full, including the MX records and the raw MIME each one leaves you to handle.

What the converter does

Everything you need to turn a pile of email files into a spreadsheet your team can actually use.

Email to JSON

Every message is decoded into a predictable JSON object: sender, recipients, subject, text and HTML bodies, headers, and the attachment list. No MIME parsing in your own code.

Custom field extraction

Name values like order_id, invoice_total, or tracking_number and MailParse finds them in the body using label matching or regex, returned as their own JSON fields.

Connected mailbox sync

Connect Gmail, Outlook, or IMAP (Starter plan and above) and MailParse checks for new mail every 15 minutes, applying your field set automatically.

Attachment metadata

Every attachment is listed by filename, MIME type, and size in the same JSON payload as the email fields, so your code knows what arrived.

Ready for a database import

Because the output is clean JSON, you map it to your schema once and import the rows directly. Email to database becomes an import, not a parsing project.

Saved templates

Save a custom field set as a template and reuse it on every future parse or sync, no reconfiguring per run.

How email-to-JSON parsing works

Three steps from a raw message to structured data in your application.

1

Upload or connect

Upload an .eml or .msg file, paste raw email text, or connect a Gmail, Outlook, or IMAP mailbox so messages flow in automatically.

2

Define your fields

Pick the standard fields and add custom fields (label matching or regex) to extract from the body, so the JSON matches what your app expects.

3

Download the JSON

MailParse parses the message and gives you structured JSON to load into your database, script, or import tool.

What developers build with MailParse JSON output

Teams that need email turned into structured data inside their own systems.

Lead capture into a CRM

Parse lead and contact-form emails into JSON and import them into Salesforce, HubSpot, or your own pipeline with the fields already mapped.

Order and shipping automation

Turn order confirmations and shipping notices from marketplaces into structured records, capturing order IDs and tracking numbers for your fulfillment system.

Email to database imports

Feed parsed email into a data warehouse or app database as rows, so reporting and search run on structured data instead of a mailbox.

Replacing a custom MIME parser

Stop maintaining a Python or Node.js email parser that breaks on encoding edge cases. Upload the file and get clean JSON back instead.

Why MailParse beats parsing email yourself

MIME handled for you

Nested parts, inline images, and mixed encodings are normalized to UTF-8 automatically, so you never touch a raw MIME tree. Attachments come listed by filename, type, and size.

Body data, not just headers

A raw parse gives you fixed headers. MailParse also extracts custom values from the message body and returns them as named fields.

No mail server to run

Connect a mailbox via OAuth or upload a file directly. No IMAP polling code, no MX records, no mail server to maintain yourself.

Keeps working when a sender changes format

Label matching and regex fields keep reading the values you named even as the surrounding template drifts, instead of a hand-rolled parser silently breaking.

Parsing email to JSON: MailParse vs building it yourself vs a transactional email webhook

For getting email into structured data there are three honest routes: write your own MIME parser, point a transactional email API's inbound webhook at your server, or use a dedicated parser that returns named fields as JSON. Looking for conditional branching instead, where each message goes to a different app depending on what it contains? That is a Zapier feature, and our guide to branching parsed mail by rule covers how it works and where it falls short. Here is how they line up on the choices a developer actually makes, with credit to each approach where it leads. For the wider field, see the best email parser guide.

What matters MailParse Build it yourself Transactional email webhook
What it does Parses an uploaded file or synced mailbox and returns the named fields you want as clean JSON Receives mail and hands you raw MIME to parse in your own code Receives mail and posts the raw parsed message to your webhook
Field extraction Name a field like order_id and it comes back separated, no parsing code You write and maintain the parser for every field and sender Mostly yours to write; you parse the posted body for business fields
Attachments Lists each attachment by filename, type, and size; extract a PDF with a document tool first You decode base64 and parse each file format yourself Delivers attachment files; your code opens and reads them
Setup and infrastructure Connect a mailbox or upload a file; no mail server or MX to run Run IMAP polling or an MX record plus an endpoint that returns 2xx Point an MX record at the provider and run a webhook endpoint
When a sender changes format Keeps reading the named fields when the layout drifts Your parser breaks and you patch it each time Your field parsing breaks; the raw delivery still arrives
Output Business-ready JSON, CSV, or Excel Whatever you build from the raw MIME tree Raw parsed message you extract the fields from
Where it also leads No parsing code to maintain and named fields returned clean Full control, no per-parse fee, and data never leaves your servers Also sends transactional email on proven high-volume infrastructure
Best for Teams that need clean named fields without building a parser Teams with the engineering time and a need for total control Teams already sending mail there that will code their own parsing

Capabilities reflect each approach as of August 2026. Transactional providers differ: Mailgun routes can do basic regex or JSONPath matching, while SendGrid, Postmark, and Brevo inbound deliver the raw parsed message for your code to extract from. Verify current features on each provider before you build.

Frequently asked questions

What is an email parser?

An email parser is a tool that breaks a raw email down into a predictable structure and returns it as clean data. Instead of writing code to handle MIME parts, encodings, and attachments yourself, you upload the message or sync a mailbox and get back clean fields, sender, subject, body, headers, attachments, and any custom values you define.

How does email-to-JSON parsing work?

You upload an .eml or .msg file, paste raw email text, or connect a mailbox, and MailParse decodes each message: it separates the MIME parts, normalizes encodings to UTF-8, lists the attachments, and pulls the custom fields you configured. Download the parsed result as JSON, ready to load into your database or script.

Can MailParse read data from attachments?

MailParse lists every attachment in the JSON output with its filename, content type, and size, so you know what arrived and can route it onward. It parses the email body into named fields, but it does not read the data inside a PDF or spreadsheet attachment. For that, send the file to a document extraction tool and merge the result with the parsed email.

How do I handle email attachments programmatically?

Parse the email with MailParse and it does the MIME parsing for you. Each attachment arrives in the JSON output listed by filename, type, and size, and the message body comes back as named fields alongside it. To read the data inside a PDF or CSV attachment, pass that file to a document extraction tool and combine its output with the parsed email JSON.

How do I get email data into a database?

Because the JSON output has consistent field names, you map those fields to your table columns once and import each parsed email as a row. Connect your mailbox for ongoing sync, or upload files for a one-off batch, then load the downloaded JSON into your database. Email to database becomes an import rather than a parsing and cleanup project.

Can MailParse pull email automatically instead of a manual upload?

Yes. Connect a Gmail, Outlook, or IMAP mailbox (Starter plan and above) and MailParse checks for new mail every 15 minutes, applying your saved field set automatically. This gives you a standing pipeline instead of uploading files one at a time.

Is there a free way to try the email parser?

Yes. You can parse a few emails for free with no account to see the JSON output shape before you commit to a plan. Paid plans add higher monthly volume, connected mailbox sync, and team access.

How much does MailParse cost?

MailParse charges a flat monthly fee per plan based on how many emails you parse per month, from a free tier to test the output, up to unlimited parsing on the Pro plan. See <a href="/pricing">pricing</a> for current plan details.

What is the best email parser?

The best email parser depends on what you need. If you only want raw inbound mail delivered, a transactional provider's webhook is enough. If you need named fields returned as clean JSON without maintaining a mailbox forwarding setup, a dedicated parser like MailParse does the field extraction yourself.

Start parsing email to JSON

Upload a sample email or connect your mailbox and get structured JSON in seconds.