E-mail (.eml) parser API
Parse a raw e-mail (.eml / MIME) into JSON: decoded subject and addresses, text and HTML, latest reply, attachments in base64, Received chain and DKIM.
Send a raw message (an .eml file, a message/rfc822 body or the source as raw) and get clean JSON: subject and names decoded from RFC 2047 (Vietnamese included), from / to / cc / bcc / reply-to as name + address, date in ISO 8601, message id, in-reply-to and references for threading, the plain text and HTML bodies (quoted-printable, base64 and legacy charsets decoded) and every attachment with its file name, MIME type, size, content id and content in base64.
latest_reply cuts the quoted history from the text ("On … wrote:", Gmail Vietnamese "Vào … đã viết:", Outlook "From: / Sent:" blocks and ">" lines), which is what a ticketing system wants to store. The Received chain is parsed (from, by, protocol, IP, time), Authentication-Results gives the SPF / DKIM / DMARC verdicts written by the receiving server, DKIM-Signature headers give domain and selector, List-Unsubscribe is returned for newsletters.
attachments=meta lists attachments without their content, none skips them; files larger than max_attachment_bytes (default 5 MB) are listed without content. Parsing uses postal-mime (MIT-0), the library recommended for Cloudflare Email Workers. Messages are processed in memory and never stored.
Parameters
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
file | body | file | no | The .eml file (multipart, raw message/rfc822 body or file_base64). | |
raw | body | string | no | Or the message source as text. | |
attachments | body|query | string | no | base64 | base64, meta (no content) or none. |
max_attachment_bytes | body|query | number | no | 5000000 | Larger attachments are listed without content. |
headers | body|query | boolean | no | true | false: leave out the full header list. |
no_html | body|query | boolean | no | false | Leave out the HTML body. |
Example
curl -X POST "https://apibox.io.vn/v1/email-parse" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: message/rfc822" \
--data-binary 'From: =?UTF-8?B?Tmd1eeG7hW4gVsSDbiBBbg==?= <an@gmail.com>
To: support@example.vn
Subject: =?UTF-8?Q?H=C3=B3a_=C4=91=C6=A1n_th=C3=A1ng_11?=
Date: Tue, 10 Nov 2026 09:15:00 +0700
Message-ID: <CAF123@mail.gmail.com>
Authentication-Results: mx.example.vn; dkim=pass header.d=gmail.com; spf=pass; dmarc=pass
Content-Type: text/plain; charset=utf-8
Chào anh, em gửi hóa đơn.
Vào Th 2, 9 thg 11, 2026 lúc 10:00 Hỗ trợ <support@example.vn> đã viết:
> Anh gửi giúp hóa đơn nhé
'const res = await fetch('https://apibox.io.vn/v1/email-parse', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'message/rfc822',
},
body: "From: =?UTF-8?B?Tmd1eeG7hW4gVsSDbiBBbg==?= <an@gmail.com>\nTo: support@example.vn\nSubject: =?UTF-8?Q?H=C3=B3a_=C4=91=C6=A1n_th=C3=A1ng_11?=\nDate: Tue, 10 Nov 2026 09:15:00 +0700\nMessage-ID: <CAF123@mail.gmail.com>\nAuthentication-Results: mx.example.vn; dkim=pass header.d=gmail.com; spf=pass; dmarc=pass\nContent-Type: text/plain; charset=utf-8\n\nChào anh, em gửi hóa đơn.\n\nVào Th 2, 9 thg 11, 2026 lúc 10:00 Hỗ trợ <support@example.vn> đã viết:\n> Anh gửi giúp hóa đơn nhé\n",
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"https://apibox.io.vn/v1/email-parse",
headers={"Authorization": "Bearer YOUR_API_KEY", "Content-Type": "message/rfc822"},
data="From: =?UTF-8?B?Tmd1eeG7hW4gVsSDbiBBbg==?= <an@gmail.com>\nTo: support@example.vn\nSubject: =?UTF-8?Q?H=C3=B3a_=C4=91=C6=A1n_th=C3=A1ng_11?=\nDate: Tue, 10 Nov 2026 09:15:00 +0700\nMessage-ID: <CAF123@mail.gmail.com>\nAuthentication-Results: mx.example.vn; dkim=pass header.d=gmail.com; spf=pass; dmarc=pass\nContent-Type: text/plain; charset=utf-8\n\nChào anh, em gửi hóa đơn.\n\nVào Th 2, 9 thg 11, 2026 lúc 10:00 Hỗ trợ <support@example.vn> đã viết:\n> Anh gửi giúp hóa đơn nhé\n".encode(),
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/email-parse');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Content-Type: message/rfc822'],
CURLOPT_POSTFIELDS => 'From: =?UTF-8?B?Tmd1eeG7hW4gVsSDbiBBbg==?= <an@gmail.com>
To: support@example.vn
Subject: =?UTF-8?Q?H=C3=B3a_=C4=91=C6=A1n_th=C3=A1ng_11?=
Date: Tue, 10 Nov 2026 09:15:00 +0700
Message-ID: <CAF123@mail.gmail.com>
Authentication-Results: mx.example.vn; dkim=pass header.d=gmail.com; spf=pass; dmarc=pass
Content-Type: text/plain; charset=utf-8
Chào anh, em gửi hóa đơn.
Vào Th 2, 9 thg 11, 2026 lúc 10:00 Hỗ trợ <support@example.vn> đã viết:
> Anh gửi giúp hóa đơn nhé
',
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));Response
{
"subject": "Hóa đơn tháng 11",
"from": {
"name": "Nguyễn Văn An",
"address": "an@gmail.com"
},
"sender": null,
"reply_to": [],
"to": [
{
"name": null,
"address": "support@example.vn"
}
],
"cc": [],
"bcc": [],
"date": "2026-11-10T02:15:00.000Z",
"message_id": "<CAF123@mail.gmail.com>",
"in_reply_to": null,
"references": [],
"return_path": null,
"delivered_to": null,
"text": "Chào anh, em gửi hóa đơn.\n\nVào Th 2, 9 thg 11, 2026 lúc 10:00 Hỗ trợ <support@example.vn> đã viết:\n> Anh gửi giúp hóa đơn nhé\n",
"html": null,
"latest_reply": "Chào anh, em gửi hóa đơn.",
"attachment_count": 0,
"attachments": [],
"authentication": {
"results": [
{
"dkim": "pass",
"spf": "pass",
"dmarc": "pass"
}
],
"dkim_signatures": [],
"received_spf": []
},
"received": [],
"list": {
"unsubscribe": null,
"unsubscribe_post": null,
"id": null
},
"headers": [
{
"key": "from",
"value": "=?UTF-8?B?Tmd1eeG7hW4gVsSDbiBBbg==?= <an@gmail.com>"
},
{
"…": "…"
}
],
"note": "Signatures are listed, not verified (DKIM / SPF results are those written by the receiving server). Nothing is stored."
}
Use cases
- Turn inbound e-mails into helpdesk tickets
- Extract invoice PDFs and XML attached to supplier e-mails
- Archive mailboxes as searchable JSON
- Debug delivery: Received hops, SPF / DKIM / DMARC results
FAQ
Are DKIM signatures verified?
No. The API reports the verdicts the receiving server wrote in Authentication-Results and lists DKIM-Signature domains; use /v1/email-auth to check a domain’s DNS records.
How big can a message be?
Up to the file size of your plan. Attachments over max_attachment_bytes (5 MB by default, 30 MB in total) are listed without content.
Are Outlook .msg files supported?
No, only MIME (.eml). In Outlook, save or forward the message as .eml first.
Related APIs
HTML to Markdown
Convert HTML or any web page URL into clean GitHub-flavored Markdown, with tables, optional article extraction and absolute links.
</>Markdown to HTML
Render GitHub-flavored Markdown to HTML with tables and strikethrough. Output is sanitized by default to strip scripts and event handlers.
<✓>HTML Sanitizer
Strip scripts, iframes, forms, event handlers, inline styles and javascript: links from untrusted HTML before you display it.