Writing a custom MIME parser is a full project — RFC 2822 has 100+ edge cases, and that's before multipart/alternative and inline images
IMAP-based parsing means polling delays (30-60 seconds), OAuth management, and stale data
Mailgun/SendGrid inbound webhooks still require you to handle multipart form data or URL-encoded payloads
Regex extraction breaks with format changes — a line break, extra space, or different date format kills your parser
Pre-processing email for LLMs means stripping HTML, decoding base64 attachments, and constructing clean prompts — all before the AI even runs
You shouldn't have to build this yourself.
Sender, subject, plain text, HTML body, headers, and thread IDs — all delivered as structured JSON. No MIME parsing on your end.
Attachments are extracted, stored, and served as URLs with content types and sizes. Your LLM gets a link, not a base64 blob.
Plain text body is automatically extracted and decoded. Pass it straight to your LLM without HTML stripping or encoding cleanup.
Email arrives, webhook fires within seconds. No IMAP polling, no OAuth tokens to refresh, no delays.
Only forward emails from domains or addresses you care about. Cut noise before it reaches your parser or LLM.
Thread IDs group related replies. Your AI agent sees the full conversation, not isolated messages.
Set up a dedicated email address for the type of email you want to parse (e.g. [email protected]).
Configure the mailhook to POST structured JSON to your AI processing endpoint — or use SSE for firewalled environments.
An email hits your address. Mailhooks parses the MIME, extracts text/HTML, decodes attachments, and delivers clean JSON.
Your LLM receives pre-structured data. Extract dates, amounts, entities, or classify intent — no custom parsing required.
Route the extracted data to your database, CRM, Notion, or trigger downstream workflows.
Mailhooks delivers this JSON to your endpoint — no MIME parsing, no encoding, no attachment handling required.
{
"id": "msg_parse_abc123",
"from": "[email protected]",
"to": ["[email protected]"],
"subject": "Invoice #INV-2024-0847 — Payment Due April 30",
"text": "Please find attached invoice #INV-2024-0847 for £2,340.00...",
"html": "Please find attached invoice...
",
"threadId": "thread_inv_789",
"attachments": [
{
"filename": "INV-2024-0847.pdf",
"contentType": "application/pdf",
"size": 145678,
"url": "https://files.mailhooks.dev/..."
}
]
}// Forward to your LLM for extraction
app.post('/webhook/mailhooks', async (req, res) => {
const { from, subject, text, attachments } = req.body;
// Clean text is already extracted — just pass it to the LLM
const extraction = await openai.chat.completions.create({
model: 'gpt-4o',
messages: [{
role: 'system',
content: 'Extract: invoice number, amount, due date, vendor name.'
}, {
role: 'user',
content: text
}],
});
const structured = JSON.parse(extraction.choices[0].message.content);
// { invoice_number: "INV-2024-0847", amount: 2340.00, due_date: "2024-04-30", vendor: "Vendor Ltd" }
await db.invoices.create({ ...structured, source_email: from });
res.sendStatus(200);
});Every inbox can be configured with sender filtering rules. You can whitelist specific domains or email addresses, or use our webhook to implement your own spam filtering logic. Emails that don't match your rules are automatically rejected.
Webhooks are typically delivered within 100-500ms of email receipt. We process emails in real-time with no polling delays. For high-availability applications, we also offer webhook retries with exponential backoff.
Mailhooks is built specifically for inbound email. We offer simpler setup (no DNS changes required for testing), better attachment handling with direct download URLs, and a developer-first API for fetching emails programmatically—perfect for E2E testing.
Yes! You can connect your own domain with simple DNS configuration. We also provide free subdomains on inbox.mailhooks.dev for testing and development.
We automatically retry failed webhooks with exponential backoff for up to 24 hours. You can also use our API to fetch any missed emails. All emails are stored and accessible via the dashboard.
Takes ~2 minutes — no email infrastructure required.
Sign up for free in seconds.
Get a unique email address for your use case.
Point to your endpoint and start receiving emails.