Email to Webhook Explained

How incoming emails become HTTP requests your application can process.

What is email to webhook?

Email to webhook is a pattern where inbound emails are converted into HTTP POST requests (webhooks) that your application receives in real-time.

Instead of polling a mailbox or running email infrastructure, you receive a webhook the moment an email arrives — with the message already parsed into structured JSON.

Email arrives
Parsed to JSON
Webhook sent

How it works

1

Email is received by the service

When someone sends an email to your Mailhooks address (e.g., [email protected]), our servers receive it via SMTP.

We handle all the infrastructure: MX records, TLS certificates, spam filtering, and high availability.

2

The email is parsed and normalized

The raw MIME message is parsed into a clean, consistent JSON structure. We handle all the complexity: multipart structures, encodings, and client variations.

{
  "id": "msg_abc123",
  "from": "[email protected]",
  "to": "[email protected]",
  "subject": "Question about my order",
  "text": "Hi, I have a question...",
  "html": "<p>Hi, I have a question...</p>",
  "headers": { ... },
  "attachments": [ ... ]
}
3

Attachments are stored and made accessible

Instead of sending base64-encoded files in the webhook payload, attachments are stored and provided as downloadable URLs. This keeps payloads small and predictable.

"attachments": [
  {
    "filename": "invoice.pdf",
    "contentType": "application/pdf",
    "size": 45678,
    "url": "https://files.mailhooks.dev/..."
  }
]
4

Webhook is sent to your endpoint

An HTTP POST request is sent to your configured endpoint with the JSON payload. Your application processes it like any other webhook.

app.post('/webhook/email', (req, res) => {
  const { from, subject, text, attachments } = req.body;

  // Process the email
  console.log(`Email from ${from}: ${subject}`);

  // Download attachments if needed
  for (const file of attachments) {
    await downloadFile(file.url);
  }

  res.status(200).send('OK');
});

Why use email to webhook?

Real-time processing

Webhooks fire instantly when email arrives. No polling delays, no checking intervals — immediate notification.

Structured data

Receive clean JSON instead of raw MIME. No parsing libraries, no encoding edge cases, no multipart handling.

Attachments as URLs

Large files don't bloat your webhook payload. Download attachments when you need them, skip them when you don't.

No infrastructure

No mail servers, no persistent connections, no uptime monitoring. Works with serverless functions.

Compared to alternatives

Email to webhook solves the problems with traditional approaches to receiving inbound email:

vs IMAP polling

IMAP polling introduces latency (your polling interval), requires managing persistent connections, and still needs MIME parsing. Webhooks are instant and stateless.

vs Email forwarding

Forwarding emails to another address loses headers, mangles attachments, and still requires you to receive and parse the forwarded message. Webhooks preserve all metadata.

vs Running your own SMTP

Running email infrastructure requires 4-6 weeks of engineering, ongoing maintenance, spam filtering, and 24/7 uptime. Webhooks let you focus on your application.

Get your first email webhook

Set up in minutes. Receive inbound emails as structured webhooks.