Email File Parser – EML, MSG & MBOX to JSON with Attachments avatar

Email File Parser – EML, MSG & MBOX to JSON with Attachments

Pricing

from $0.50 / 1,000 email parseds

Go to Apify Store
Email File Parser – EML, MSG & MBOX to JSON with Attachments

Email File Parser – EML, MSG & MBOX to JSON with Attachments

Parse .eml, Outlook .msg and .mbox mailbox files into JSON: from/to/cc, subject, ISO date, text and HTML body, attachments (optionally saved), Message-ID thread IDs and SPF/DKIM/DMARC results. $0.50 per 1,000 emails.

Pricing

from $0.50 / 1,000 email parseds

Rating

0.0

(0)

Developer

Cemal Atakli

Cemal Atakli

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

2 days ago

Last modified

Categories

Features

Limited permissions

Share

Turn email files into clean JSON. Give it links to .eml files, Outlook .msg files or whole .mbox mailboxes (Gmail Takeout, Thunderbird, Apple Mail, mailing-list archives) and get one row per message: sender, recipients, subject, ISO date, plain-text and HTML body, the attachment list, Message-ID / In-Reply-To / References with a ready thread ID, and the SPF / DKIM / DMARC results the receiving server recorded.

The format is detected from the file content, not the file name. Big mailboxes are read one message at a time, so memory use stays low (tested up to a few MB locally; files up to 2 GB are accepted). $0.50 per 1,000 emails.

Use cases

  • eDiscovery and compliance exports: turn a custodian's .mbox or a folder of .msg files into a table you can filter, search and load into a database.
  • Mailbox migration and archiving: convert Gmail Takeout or Thunderbird mailboxes to JSON/CSV/Excel with thread IDs kept.
  • Feeding AI / RAG pipelines: clean textBody (or htmlAsText, plain text made from the HTML part) per message, with the metadata to cite it.
  • Phishing and deliverability triage: read spf, dkim, dmarc, dkimDomains and the full Authentication-Results of reported emails; list attachments with SHA-256 hashes for threat-intel lookups, without opening them.
  • Invoice / order mailbox processing: extract every PDF/XLSX attachment of a mailbox into a key-value store, with a link per file.

Input

FieldDefaultNotes
fileUrlsa small demo .eml (a Python test file with fake addresses)Direct links to .eml, .msg or .mbox files. Links that redirect are followed.
uploadedFiles + uploadStore–Upload files from your computer in the Console. Also select the store you uploaded into (the Actor runs with limited permissions).
datasetId / datasetField– / urlRead file URLs from one of your datasets.
saveAttachmentsfalseSave attachments into this run's key-value store and add kvKey + url to each attachment. Charged per saved file.
saveInlineImagesfalseAlso save inline (cid:) images such as logos and signatures.
maxAttachmentSizeMb25Bigger attachments are listed but not saved.
includeHtmlBodytrueOff: only textBody and htmlAsText.
includeRawHeadersfalseAdd every header (Received chain, X- headers) as a headers list.
maxBodyChars100,000Body fields are cut to this length (bodyTruncated: true). 0 = no limit.
maxMessages0 (no limit)Stop after N messages, e.g. to preview a big mailbox.
maxFileSizeMb200Bigger files are refused (free). Up to 2,000.
{
"fileUrls": ["https://example.com/exports/inbox.mbox", "https://example.com/mail/quote-request.msg"],
"saveAttachments": true,
"includeHtmlBody": false
}

Output (one row per message)

{
"source": "https://raw.githubusercontent.com/python/cpython/main/Lib/test/test_email/data/msg_07.txt",
"fileName": "msg_07.txt",
"format": "eml",
"messageIndex": 1,
"status": "ok",
"subject": "Here is your dingus fish",
"normalizedSubject": "Here is your dingus fish",
"date": "2001-04-20T19:35:02-04:00",
"from": "Barry <barry@digicool.com>",
"fromName": "Barry",
"fromAddress": "barry@digicool.com",
"to": ["Dingus Lovers <cravindogs@cravindogs.com>"],
"cc": [], "bcc": [], "replyTo": [],
"recipientAddresses": ["cravindogs@cravindogs.com"],
"messageId": null, "inReplyTo": null, "references": [], "threadId": null,
"textBody": "Hi there,\n\nThis is the dingus fish.",
"htmlBody": "", "htmlAsText": "", "bodyTruncated": false,
"attachments": [{
"name": "dingusfish.gif", "mimeType": "image/gif", "size": 3512,
"sha256": "354288075c6cd6c6a99180ef60b99f599b4e3d6c28bd67c29adc736079e52a84",
"contentId": null, "inline": false,
"kvKey": "att-001-00001-01-dingusfish.gif",
"url": "https://api.apify.com/v2/key-value-stores/<store>/records/att-001-00001-01-dingusfish.gif"
}],
"attachmentCount": 1, "hasAttachments": true,
"authenticationResults": [], "dkimDomains": [], "spf": null, "dkim": null, "dmarc": null
}
  • Outlook .msg rows also have messageClass (e.g. IPM.Note) and conversationIndex. Without RFC thread headers, threadId is conv:<conversation index>, so replies in one Outlook conversation share a thread ID.
  • threadId is the first References ID, else In-Reply-To, else the message's own Message-ID. Group by it to rebuild conversations.
  • Embedded emails (forwarded-as-attachment, bounces, digests, .msg inside .msg) are listed as attachments with an embeddedMessage summary (subject, from, date).
  • Error rows (status: "error", errorCode, error) are free: bad link, HTTP error, file too large, not an email file, private-network address.
  • The run summary (messages, attachments, errors, formats, whether the max charge stopped the run) is in the OUTPUT record of the key-value store.

Attachments are never opened

Attachments are read only to count their size and compute a SHA-256 hash. When saveAttachments is on, each file is stored as application/octet-stream, whatever its declared type, so a browser downloads it instead of showing or running it. Nothing inside an attachment is executed, unpacked or rendered. Be careful with attachments from unknown senders when you open them on your own computer.

Privacy

Mailboxes contain personal data. The files you give are downloaded into the run's temporary disk, parsed and deleted when the run ends. The results and saved attachments go only to your own run storage (dataset and key-value store) in your Apify account; we do not keep a copy. Apify deletes unnamed run storage after your plan's retention period. Process only mail you are allowed to process.

Limits (please read)

  • Supported: RFC 5322 .eml (any MIME structure, RFC 2047 encoded headers, any charset Python knows), .mbox (mboxo/mboxrd "From " separated, incl. Gmail Takeout), Outlook .msg (OLE2/CFB, Unicode and ANSI).
  • Not supported: .pst/.ost Outlook data files, Maildir folders, .emlx, TNEF winmail.dat contents (listed as an attachment, not unpacked), S/MIME or PGP decryption, ZIP archives of mail (unzip them first, e.g. with our Archive Extractor).
  • Outlook RTF-only bodies are converted to plain text with a simple RTF reader: formatting and tables are lost, and htmlBody is empty. Most Outlook messages also carry an HTML or text body, which is used first.
  • Outlook .msg recipients stored only as Exchange addresses (/O=EXCHANGELABS/...) without an SMTP address appear by display name only.
  • .msg files are read whole into memory; keep single .msg files under about 200 MB at 256 MB memory. MBOX and EML size is limited only by maxFileSizeMb.
  • An Apify dataset row is limited to about 9 MB, which is why bodies are cut at maxBodyChars (100,000 characters each by default).
  • Links must be direct file links that a server returns without logging in. Private and internal network addresses (localhost, 10.x, 192.168.x, cloud metadata) are refused.

Pricing

Pay per event:

EventPriceWhen
Email parsed$0.0005 ($0.50 per 1,000)each message returned with status: "ok"
Attachment saved$0.0005each attachment stored in the key-value store (only with saveAttachments)
Actor start$0.00005once per run

Error rows are free. Listing attachments (name, type, size, SHA-256) without saving them is free. The run stops cleanly when your maximum total charge is reached; OUTPUT then has stoppedAtMaxCharge: true.

ActorFormatsPrice
This ActorEML + MSG + MBOX in one run, attachments, threads, SPF/DKIM/DMARC$0.50 / 1,000 emails
Single-format MSG-to-JSON and MBOX-to-JSON Actors in the Storeone format eachsee their pricing pages

How this differs from our other listings

Use with AI agents (Apify MCP)

Through the Apify MCP server, an AI agent can call gazidev/email-file-parser with fileUrls and get structured messages back, e.g. "read this .msg and tell me who was copied and what was attached", or "summarise this mailing-list archive by thread". Set includeHtmlBody: false to keep the agent's context small.

FAQ

Does it work with Gmail Takeout? Yes. Takeout gives .mbox files; host the file somewhere with a direct link or upload it in the Console.

Can it read a .pst file? No, only .msg, .eml and .mbox. Export the folder from Outlook as .msg files, or convert the PST to MBOX first.

Are attachments scanned for viruses? No. They are not opened at all. Use the SHA-256 in the output to look them up in your threat-intel tool.

Why is messageId null for some emails? The file has no Message-ID header (common in drafts, test files and some Outlook items). Outlook items still get a conv: thread ID.

Licence of libraries: Python standard library (email, mailbox), olefile (BSD-2) and compressed-rtf (MIT). No GPL code.