What is an email webhook?
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.
Why developers choose email webhooks
Real-time delivery
Webhooks fire instantly when an email arrives. No polling interval, no delays — your application responds the moment a message comes in.
Structured JSON payloads
No MIME parsing, no encoding edge cases. Every email arrives as clean JSON with from, to, subject, body, headers, and attachment metadata.
No mail server to run
No SMTP servers, no MX records, no TLS certificates. Mailhooks handles all the infrastructure so you focus on your application.
Works with serverless
Email webhooks are standard HTTP POST requests. They work with AWS Lambda, Vercel, Cloudflare Workers, or any endpoint that can receive a webhook.
How email webhooks work
Create an inbox and get your email address
Sign up for Mailhooks and create an inbox. You'll get a unique email address like [email protected], or connect your own custom domain.
Point your webhook URL
Configure the endpoint URL where Mailhooks should send POST requests. This can be any URL — your server, a serverless function, or an integration endpoint.
Email arrives and webhook fires
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/..."
}
]
}Process the email in your app
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');
});Email webhook use cases
Developers use email webhooks to power a wide range of workflows:
Reply-by-email for SaaS
Let users respond to notifications directly from their inbox.
Email to webhook triggers
Trigger workflows and automations the moment an email arrives.
n8n email trigger
Use Mailhooks as the email trigger for n8n automations.
Receive email attachments
Extract, store, and process email attachments automatically.
Email testing in CI/CD
Test email flows in Playwright and Cypress with real webhooks.
Email webhooks vs other approaches
There are several ways to receive inbound email. Here's how email webhooks compare:
vs IMAP polling
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.
vs Email forwarding
Forwarding emails to another address loses original headers, mangles attachments, and creates forwarding loops. Webhooks preserve all email metadata in structured JSON.
vs Running your own SMTP server
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.