An email webhook is an HTTP callback that fires automatically when an email is received. Instead of polling a mailbox or running your own mail server, your application gets a POST request the moment a message arrives — with the email already parsed into structured JSON.
Think of it like Stripe webhooks for payments, but for email. You provide an endpoint URL, and every inbound email triggers a real-time webhook with the full message data.
Webhooks fire instantly when an email arrives. No polling interval, no delays — your application responds the moment a message comes in.
No MIME parsing, no encoding edge cases. Every email arrives as clean JSON with from, to, subject, body, headers, and attachment metadata.
No SMTP servers, no MX records, no TLS certificates. Mailhooks handles all the infrastructure so you focus on your application.
Email webhooks are standard HTTP POST requests. They work with AWS Lambda, Vercel, Cloudflare Workers, or any endpoint that can receive a webhook.
Sign up for Mailhooks and create an inbox. You'll get a unique email address like [email protected], or connect your own custom domain.
Configure the endpoint URL where Mailhooks should send POST requests. This can be any URL — your server, a serverless function, or an integration endpoint.
When someone sends an email to your address, Mailhooks receives it, parses the MIME content, extracts attachments, and POSTs structured JSON to your endpoint — all in real-time.
{
"id": "msg_abc123",
"from": "[email protected]",
"to": "[email protected]",
"subject": "New support request",
"text": "I need help with my account...",
"html": "<p>I need help with my account...</p>",
"headers": {
"message-id": "<[email protected]>",
"date": "2025-01-15T10:30:00Z"
},
"attachments": [
{
"filename": "screenshot.png",
"contentType": "image/png",
"size": 245678,
"url": "https://files.mailhooks.dev/..."
}
]
}Handle the webhook payload like any other HTTP request. Route by sender, subject, or content. Download attachments on demand.
// Handle email webhooks in your app
app.post('/webhooks/email', (req, res) => {
const { from, subject, text, attachments } = req.body;
// Route based on subject or sender
if (subject.includes('support')) {
createTicket({ from, subject, body: text });
}
// Process attachments when needed
for (const file of attachments) {
downloadFile(file.url); // Only when you need it
}
res.status(200).send('OK');
});Developers use email webhooks to power a wide range of workflows:
Let users respond to notifications directly from their inbox.
Trigger workflows and automations the moment an email arrives.
Use Mailhooks as the email trigger for n8n automations.
Extract, store, and process email attachments automatically.
Test email flows in Playwright and Cypress with real webhooks.
There are several ways to receive inbound email. Here's how email webhooks compare:
IMAP polling introduces latency (you only see new mail when you check), requires persistent connections that drop, and still needs MIME parsing. Email webhooks deliver instantly with no connection management.
Forwarding emails to another address loses original headers, mangles attachments, and creates forwarding loops. Webhooks preserve all email metadata in structured JSON.
Running email infrastructure requires weeks of engineering, ongoing maintenance, spam filtering, and 24/7 uptime monitoring. Webhooks eliminate all of that — you just receive POST requests.