one mx record.
all emails as json webhooks.

$npm install mymx

across all of your domains, free.

the code
import { handleWebhook, MyMXWebhookError, MYMX_CONFIRMED_HEADER } from 'mymx';
export async function POST(req: Request) {
const body = await req.text();
try {
const event = handleWebhook({
body,
headers: Object.fromEntries(req.headers),
secret: process.env.WEBHOOK_SECRET!,
});
// Access email data
console.log('From:', event.email.headers.from);
console.log('Subject:', event.email.headers.subject);
console.log('Body:', event.email.parsed.body_text);
// Confirm processing (enables content discard if configured)
return new Response(null, {
status: 200,
headers: { [MYMX_CONFIRMED_HEADER]: 'true' },
});
} catch (err) {
if (err instanceof MyMXWebhookError) {
return new Response(null, { status: 400 });
}
throw err;
}
}
the webhook json
1{
2 "id": "evt_a1b2c3d4e5f6a7b8c9d0e1f2",
3 "event": "email.received",
4 "version": "2025-12-14",
5 "delivery": {
6 "endpoint_id": "ep_abc123def456",
7 "attempt": 1,
8 "attempted_at": "2025-12-18T12:00:00.000Z"
9 },
10 "email": {
11 "id": "em_e1a2b3c4-d5e6-7f8a-9b0c-1d2e3f4a5b6c",
12 "received_at": "2025-12-18T12:00:00.000Z",
13 "smtp": {
14 "helo": "mail.example.com",
15 "mail_from": "sender@example.com",
16 "rcpt_to": [
17 "recipient@yourdomain.com"
18 ]
19 },
20 "headers": {
21 "message_id": "<1234567890@example.com>",
22 "subject": "Hello from MyMX",
23 "from": "Sender Name <sender@example.com>",
24 "to": "recipient@yourdomain.com",
25 "date": "Wed, 18 Dec 2025 12:00:00 +0000"
26 },
27 "content": {
28 "raw": {
29 "included": true,
30 "encoding": "base64",
31 "max_inline_bytes": 262144,
32 "size_bytes": 1024,
33 "sha256": "a1b2c3d4...",
34 "data": "RnJvbTogc2VuZGVyQGV4YW1wbGUuY29t..."
35 },
36 "download": {
37 "url": "https://api.mymx.dev/v1/downloads/raw/token",
38 "expires_at": "2025-12-19T12:00:00.000Z"
39 }
40 },
41 "parsed": {
42 "status": "complete",
43 "error": null,
44 "body_text": "Hello! This is a test email from MyMX.",
45 "body_html": "<p>Hello! This is a test email from MyMX.</p>",
46 "attachments": [
47 {
48 "filename": "document.pdf",
49 "content_type": "application/pdf",
50 "size_bytes": 24576,
51 "sha256": "b2c3d4e5f6...",
52 "part_index": 0,
53 "tar_path": "0_document.pdf"
54 }
55 ],
56 "attachments_download_url": "https://api.mymx.dev/v1/downloads/attachments/token"
57 },
58 "analysis": {
59 "spamassassin": {
60 "score": 2
61 }
62 }
63 }
64}