What is an inbound email API?
An inbound email API is a service that receives emails on your behalf and delivers them to your application via HTTP webhooks or a REST API. Instead of building your own email infrastructure, you make a few API calls and receive inbound email as structured data.
With Mailhooks, you create an inbox, configure your webhook URL, and every incoming email is parsed into JSON and delivered to your endpoint in real-time. No SMTP servers, no IMAP connections, no MIME parsing.
Why developers use an inbound email API
Structured JSON payloads
Every email is parsed into clean JSON — sender, subject, body, headers, and attachments. No MIME parsing libraries needed.
Real-time webhook delivery
Emails are forwarded to your endpoint instantly. No polling, no delays, no connection management. Your app reacts in milliseconds.
Zero email infrastructure
No SMTP servers, MX records, TLS certificates, or spam filtering. Mailhooks handles all the hard parts.
Reliable and secure
Built-in retry logic, webhook signatures for verification, and encrypted attachment storage. Enterprise-grade reliability for every plan.
Custom domains
Use your own domain for receiving email. Add DNS records and start receiving at addresses like [email protected].
Developer-first DX
TypeScript SDK, thorough documentation, and consistent JSON schemas. Build in minutes, not weeks.
The inbound email API in action
Set up an inbox, point your webhook URL, and receive email as JSON. Here's what the flow looks like:
Create an inbox via the API
Use the Mailhooks API or dashboard to create a new inbox. Each inbox gets a unique email address for receiving mail.
// Create an inbox
const inbox = await mailhooks.inboxes.create({
name: 'Support Inbox',
webhookUrl: 'https://yourapp.com/api/webhooks/email'
});
// inbox.email → "[email protected]"Receive email and get a webhook
When someone sends an email to your inbox address, Mailhooks parses it and POSTs structured JSON to your webhook URL.
{
"id": "msg_xyz789",
"inboxId": "inbox_abc123",
"from": "[email protected]",
"to": "[email protected]",
"subject": "Help with my subscription",
"text": "Hi, I need to cancel my plan...",
"html": "<p>Hi, I need to cancel my plan...</p>",
"headers": {
"message-id": "<[email protected]>",
"date": "2025-03-15T14:30:00Z",
"in-reply-to": null
},
"attachments": [
{
"filename": "receipt.pdf",
"contentType": "application/pdf",
"size": 125432,
"url": "https://files.mailhooks.dev/..."
}
]
}Process in your application
Handle the webhook like any other HTTP POST. Route by sender, subject, or content. Download attachments when you need them.
// Express.js webhook handler
app.post('/api/webhooks/email', (req, res) => {
const { from, subject, text, attachments } = req.body;
// Route based on content
if (subject.toLowerCase().includes('cancel')) {
handleCancellation(from, text);
} else if (subject.toLowerCase().includes('support')) {
createSupportTicket({ from, subject, body: text });
}
// Optionally download attachments
for (const file of attachments) {
if (file.contentType === 'application/pdf') {
processDocument(file.url);
}
}
res.status(200).send('OK');
});Common inbound email API use cases
Inbound email API vs alternatives
How does an inbound email API compare to other approaches?
vs building your own SMTP server
Running your own mail server for inbound email means dealing with DNS configuration, TLS certificates, spam filtering, bounce handling, and 24/7 uptime. An inbound email API handles all of this for you — read why receiving email is hard.
vs IMAP polling
IMAP polling checks for new mail on an interval, introducing latency and requiring persistent connections. An API delivers emails instantly via webhooks — no polling, no connections to manage.
vs Mailgun and SendGrid
Mailgun and SendGrid are full email platforms focused on outbound delivery. Their inbound features are secondary, with complex routing rules and enterprise pricing. Mailhooks is purpose-built for inbound — simpler setup, cleaner payloads, and transparent pricing.