Webhooks require exposing a public endpoint that accepts inbound requests
Polling the email API is slow, inefficient, and wastes resources
Setting up ngrok or tunnels for local development is tedious
Worker processes need complex queue infrastructure to coordinate
You shouldn't have to build this yourself.
SSE uses outbound connections. No need to expose endpoints or configure firewalls.
Notifications arrive within milliseconds of email receipt. No polling delays.
Distributed mode load-balances notifications across workers automatically.
Browsers, long-running workers, local dev — anywhere that can maintain connections.
Add the Mailhooks SDK to your project.
Call realtime.subscribe() with your handlers.
Your handler fires instantly when emails arrive.
Use the email metadata or fetch full content via API.
SDK handles reconnection automatically on network issues.
Subscribe to real-time push notifications with just a few lines of code.
{
"type": "email.received",
"timestamp": "2025-01-15T10:30:00.000Z",
"data": {
"id": "email_abc123",
"from": "[email protected]",
"to": ["[email protected]"],
"subject": "New order #12345",
"domain": "yourapp.mailhooks.dev",
"hasAttachments": true,
"attachmentCount": 1,
"createdAt": "2025-01-15T10:30:00.000Z"
}
}import { Mailhooks } from '@mailhooks/sdk';
const mailhooks = new Mailhooks({ apiKey: 'mh_xxx' });
// Subscribe to push notifications
const subscription = mailhooks.realtime.subscribe({
// Choose mode: 'broadcast' (all clients) or 'distributed' (load balance)
mode: 'broadcast',
onConnected: (payload) => {
console.log('Connected!', payload.connectionId);
},
onEmailReceived: async (email) => {
console.log(`New email from ${email.from}: ${email.subject}`);
// Fetch full email content if needed
const content = await mailhooks.emails.getContent(email.id);
processEmail(content);
},
onError: (error) => {
console.error('Connection error:', error);
},
autoReconnect: true, // Auto-reconnect on disconnect
});
// Later, disconnect when done
subscription.disconnect();Every inbox can be configured with sender filtering rules. You can whitelist specific domains or email addresses, or use our webhook to implement your own spam filtering logic. Emails that don't match your rules are automatically rejected.
Webhooks are typically delivered within 100-500ms of email receipt. We process emails in real-time with no polling delays. For high-availability applications, we also offer webhook retries with exponential backoff.
Mailhooks is built specifically for inbound email. We offer simpler setup (no DNS changes required for testing), better attachment handling with direct download URLs, and a developer-first API for fetching emails programmatically—perfect for E2E testing.
Yes! You can connect your own domain with simple DNS configuration. We also provide free subdomains on inbox.mailhooks.dev for testing and development.
We automatically retry failed webhooks with exponential backoff for up to 24 hours. You can also use our API to fetch any missed emails. All emails are stored and accessible via the dashboard.
Takes ~2 minutes — no email infrastructure required.
Sign up for free in seconds.
Get a unique email address for your use case.
Point to your endpoint and start receiving emails.