Quickstart

Get your first email webhook in 5 minutes.

1. Create an account

Sign up at mymx.dev and add your first domain.

2. Configure DNS

Add the MX record shown in your dashboard to your domain's DNS settings. This tells email servers to route mail through MyMX.

yourdomain.com. MX 10 mx.mymx.dev.

DNS propagation typically takes a few minutes to a few hours.

3. Add a webhook endpoint

In your dashboard, add the URL where you want to receive emails. MyMX will POST a JSON payload to this URL for every email received.

4. Handle the webhook

Install the SDK:

npm install mymx

Create a webhook handler:

import { handleWebhook, MyMXWebhookError } from 'mymx';
export async function POST(request: Request) {
try {
const event = handleWebhook({
body: await request.text(),
headers: request.headers,
secret: process.env.MYMX_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);
return Response.json({ received: true });
} catch (err) {
if (err instanceof MyMXWebhookError) {
return Response.json({ error: err.code }, { status: 400 });
}
throw err;
}
}

5. Send a test email

Send an email to any address at your domain. Within seconds, you should receive a webhook at your endpoint.


Ready to dive deeper? Check out the Webhook Payload reference for the full schema.