MXHook is a self-hosted SMTP server that receives email, parses it into structured JSON, and delivers it to your application via webhooks. An open-source alternative to Mailgun Routes, Sendgrid Inbound Parse, and Postmark Inbound.
From MX record to webhook in minutes.
Add a single DNS record to route your domain's inbound email to MXHook.
Headers, body, and attachments are extracted into structured JSON. RFC 5322 compliant.
MXHook POSTs JSON to your endpoint, signed with HMAC-SHA256, with automatic retries on failure.
Every inbound email becomes a signed HTTP POST with structured JSON. Headers, body, attachments — parsed and ready to use.
{
"from": "alice@example.com",
"to": ["support@yourapp.com"],
"subject": "Order #1234 issue",
"text": "Hi, I have a problem with my order...",
"html": "<p>Hi, I have a problem with my order...</p>",
"headers": {
"message-id": "<abc123@example.com>",
"in-reply-to": "<prev456@example.com>",
"date": "2026-03-19T10:30:00Z"
},
"attachments": [
{
"filename": "screenshot.png",
"content_type": "image/png",
"size": 48210
}
]
}Production-ready features, out of the box.
Route emails by exact match, wildcard, or plus-addressing. *@yourapp.com routes all mail. user+tag@yourapp.com strips the tag and matches. Priority-ordered rules give you full control.
Every delivery includes an X-MXHook-Signature header with an HMAC-SHA256 hash. Verify authenticity with constant-time comparison. One line of code.
Failed deliveries retry with exponential backoff. After max attempts, messages land in a dead letter queue. Replay any message via the API.
Original .eml files are stored alongside parsed data. Useful for compliance, auditing, or reprocessing later.
mxhook_messages_received_total, mxhook_delivery_latency_seconds — latency, throughput, and error rates exposed out of the box.
Manage domains, routes, messages, and DLQ entries programmatically. Full OpenAPI 3.1 spec included. Authenticate with API keys.
Register as many domains as you need. Each domain gets its own routing rules, webhook endpoints, and delivery logs.
Run on your infrastructure with Docker Compose, or deploy to any container platform. Your data never leaves your network.
Autonomous agents and LLM-powered workflows need to receive email — support requests, notifications, form submissions, approval chains. MXHook delivers structured JSON over HTTP. No IMAP libraries. No email parsing SDKs. Just an HTTP POST with clean data.
Subject, sender, body, threading headers (In-Reply-To, References), and attachments arrive as typed JSON fields. No parsing step needed.
Your agent receives email the same way it receives any event: a signed HTTP POST to an endpoint you control.
Route different senders, domains, or subject patterns to different agent endpoints. Support emails go to one agent, billing to another.
In-Reply-To and References headers let agents track multi-turn email conversations without external state.
@app.post("/webhook/support")
async def handle_support_email(payload: dict):
customer = payload["from"]
subject = payload["subject"]
body = payload["text"]
thread_id = payload["headers"].get("in-reply-to")
# Extract intent using an LLM
intent = await llm.classify(
f"Subject: {subject}\nBody: {body}"
)
if intent == "order_issue":
order_id = extract_order_id(subject)
order = await db.get_order(order_id)
response = await llm.draft_response(order, body)
await email.send(to=customer, body=response)
elif intent == "refund_request":
await tickets.create(
customer=customer,
type="refund",
context=body,
thread=thread_id
)MXHook core is licensed under Apache 2.0. Run it on your infrastructure. Full source on GitHub. No vendor lock-in, no data leaving your network, no usage limits.
Enterprise features — regex routing, header-based conditions, RBAC — are available under a Business Source License that converts to Apache 2.0 after two years.
MXHook Cloud is a fully managed version — we run the SMTP servers, handle scaling, and guarantee uptime. You configure routes and receive webhooks. Currently in development.
Join the waitlistEverything you need to know about MXHook.