For developers

EML Parser API: Parse EML Files and Outlook MSG Files to JSON

One endpoint for .eml and .msg, one JSON shape back

Two file formats, two families of libraries, and a pile of encoding edge cases sit between a saved email and the fields your app needs. MailParse parses EML and MSG files behind one REST call with a bearer token and returns the same JSON record for both. Paste a sample message into the tool to see the record before you write a line of code.

.eml and Outlook .msg
Same JSON for both formats
Custom fields by label or regex
Every call in your audit trail
Convert your email files
No install

Connect a Gmail or IMAP mailbox to parse new mail automatically, or paste an email below 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 EML parser API reads a saved .eml message and returns its parts as structured data instead of raw MIME. MailParse takes an .eml file, an Outlook .msg file or raw message text at POST /api/parse and answers with one JSON record: from, to, cc, bcc, date, subject, plain text body, the attachment list, and any custom fields you name. The same endpoint and the same JSON shape cover both formats.

2 formats
.eml and .msg, one endpoint
201
Parsed record in the response
50 MB
File ceiling on Plus and Pro
60/min
Parse calls per minute

Most teams that need to parse EML files end up with two parsers. The .eml side is plain MIME text, so Python's email package, the eml_parser module or a Node package gets you headers and parts in an afternoon. Then someone forwards an Outlook export and the .msg files turn out to be OLE compound documents with MAPI properties, codepages and recipient tables, and you pull in extract-msg or msgreader, map their output onto the shape you already had, and discover that the two libraries disagree about where the sender lives and how dates are formatted. After that come the edge cases: quoted-printable bodies, a MIME preamble that swallows the text part, base64 attachments that bloat memory on a 40 MB file.

The MailParse EML parser API puts all of that behind one request. You send the file as a multipart file field, or the raw message as a raw string, with a personal access token in the Authorization header. You get back a 201 response whose record holds the same keys whichever format you sent: from, to, cc, bcc, date in ISO 8601, subject, body, and an attachments array with the filename, type and size of each file. Add custom_fields[] and the values you name, such as an order number or a claim reference, come back as their own keys.

curl -X POST https://mailparse.ai/api/parse \
  -H "Authorization: Bearer $MAILPARSE_TOKEN" \
  -H "Accept: application/json" \
  -F "[email protected]" \
  -F "fields[]=from" -F "fields[]=date" -F "fields[]=subject" \
  -F "custom_fields[0][key]=claim_number" \
  -F "custom_fields[0][pattern]=/Claim (?:No|#)\.?\s*(\d+)/i"

A custom field takes either a label, which reads the text after it on the same line, or a regex whose first capture group becomes the value. Both search the subject and the plain text body. The response also carries a body_truncated flag, the parse_job_id you can fetch again with GET /api/parse/{id}, and your usage for the month, which GET /api/usage also reports on its own so a batch job can pace itself. For the wider picture, including mailbox sync and HTML table extraction in the app, see the email parser API overview, and if the goal is JSON for a pipeline rather than a single file format, email to JSON covers that route.

What the EML parser API returns

Built for teams that receive saved messages as files and need the fields, not the MIME tree.

EML and MSG through one call

Send a MIME .eml file or an Outlook .msg compound file to the same endpoint. You do not branch on the extension or run two libraries, and your code reads one schema.

A stable JSON record

Every response uses the same keys: from, to, cc, bcc, date, subject, body and attachments. Ask for a subset with fields[] and the rest are left out, so the payload matches what you store.

Custom fields by label or regex

Name up to 20 fields per call. Give a label like Invoice # and the text after it is returned, or give a regex and the first capture group is. Values the message does not contain come back as null.

Large files without memory spikes

EML files are read as a stream, so a 48 MB message with a big attachment parses without loading the attachment into memory. Plus and Pro accept files up to 50 MB, Starter up to 25 MB.

Attachments listed, not dumped

Each attachment comes back as filename, content type and size, so your code can decide what to fetch or route. The API does not return file bytes and does not read inside PDFs.

Scoped tokens and an audit trail

Tokens carry separate parse and read permissions, and every API parse and read is written to your team audit log, which matters when the files are client or claim records.

How to parse an EML file with the API

Four steps from a saved message on disk to a JSON record in your app.

1

Create a token

On any paid plan, open API Tokens in your account and create a token with the parse permission. Add read if you also want to fetch results later.

2

POST the file

Send the .eml or .msg as a multipart file field to /api/parse with the token as a Bearer header, or post the raw message text as the raw field.

3

Name your fields

Optionally pass fields[] to trim the standard keys and custom_fields[] with a key and a label or regex for each business value you need.

4

Store the record

Read record from the 201 response and write it to your database, queue or search index. Check usage in the same response to pace large batches.

Who needs an EML parser API

Teams whose email arrives as files rather than as a live mailbox.

Legal and eDiscovery intake

Clients and opposing counsel send exported .msg and .eml files. Parse each one into sender, recipients, date and subject for a review index instead of opening them in Outlook one by one.

Insurance and claims teams

Adjusters save correspondence as .msg files into claim folders. Pull the claim number, policy number and dates into your claims system with a regex field per value.

SaaS products with email import

If your users upload saved emails into your product, call the API from your backend and skip shipping and patching two parsing libraries in your own stack.

Compliance and records retention

Build a searchable register of archived messages with sender, date, subject and attachment names, with every parse logged to an audit trail your reviewers can check.

Why teams call an API instead of maintaining a parser

One schema for two formats

EML and MSG libraries return different shapes. The API returns one, so the mapping code is written once.

Edge cases already handled

MIME preambles, quoted-printable bodies, codepages in .msg properties and oversized attachments are dealt with on our side and fixed centrally when a new case turns up.

Business fields, not just headers

Libraries give you headers and parts. The API also returns the named values you asked for as their own keys.

Metered, logged, permissioned

Tokens have scopes, usage is visible from the API itself, and each call is audited, which is hard to retrofit onto a script.

EML parser options compared: MailParse API vs open source libraries vs a commercial SDK

There are three honest ways to parse EML and MSG files in production. Open source libraries are free and run locally, a commercial SDK adds broad format support inside your own process, and a hosted API returns finished records. Here is where each one leads.

What matters MailParse API Open source libraries (eml_parser, extract-msg, msgreader) Commercial SDK (for example Aspose.Email)
Formats .eml, Outlook .msg and raw message text through one endpoint Usually one format per library, so EML and MSG need two Wide format coverage in one library, including conversion between formats
Output One JSON record with the same keys for every format Library-specific objects you map to your own schema An object model you map to your own schema
Business fields Custom fields by label or regex returned as their own keys You write the extraction code You write the extraction code
Where it runs Hosted; your code sends the file over HTTPS Inside your own process, fully offline Inside your own process, fully offline
Cost model Flat monthly plan; API calls share the plan allowance Free, paid for in engineering time Per-developer or per-deployment license
Where it also leads No parser to maintain, audit trail and scoped tokens included No data leaves your servers and no per-message limit Converts to other formats and works without a network call
Best for Teams that want finished records from both formats without owning the parser Teams with engineering time and a strict offline requirement Teams that need format conversion inside their own application

Library and SDK capabilities vary by version. Check each project's current documentation before you choose. No prices are listed because they change.

Frequently asked questions

How do I parse an EML file?

Send it to an EML parser. With MailParse you POST the .eml file to /api/parse with a bearer token and get back a JSON record holding the sender, recipients, date, subject, body and attachment list. Without code, upload the file in the app and download the same record as JSON, CSV or Excel.

How do I parse an Outlook MSG file?

An .msg file is an OLE compound document, not MIME text, so ordinary email libraries cannot read it. Send it to the same /api/parse endpoint you use for .eml files and MailParse returns the same JSON keys, so your code does not need a second parser or a copy of Outlook.

Can I convert EML to JSON?

Yes. The API response is already JSON: a record with from, to, cc, bcc, date, subject, body and attachments, plus one key per custom field you requested. The web app also exports the same record as a JSON file if you would rather not call the API.

Does the API return attachment contents?

No. Each attachment is listed with its filename, content type and size so your code knows what arrived. The API does not return the file bytes or read inside a PDF or spreadsheet. If you need data from inside an attachment, extract that document with a document tool and join it to the parsed record.

Which plans include the EML parser API?

Every paid plan. API calls count against the same monthly parse allowance as the web app, the file ceiling follows your plan (25 MB on Starter, 50 MB on Plus and Pro), and parse calls are limited to 60 per minute per account.

What happens when I hit my monthly limit?

The API answers 429 with a limit_reached error and your plan name instead of parsing the file. Call GET /api/usage, or read the usage block in each parse response, to slow a batch down before that happens, or move to a larger plan.

Is there an open source EML parser I could use instead?

Yes. Python's eml_parser module and email package, and extract-msg or msgreader for .msg files, are solid if you have engineering time and must stay offline. You then maintain the field extraction and the mapping between formats yourself. The API is for teams who would rather pay than own that code.

Parse your first EML file

Upload a sample .eml or .msg to see the JSON record, then create a token and call the API from your code.