MX Records
To receive email with MXHook, you need to point your domain's MX (Mail Exchange) records at the server running MXHook.
Setup
Add an MX record to your domain's DNS:
| Type | Name | Value | Priority |
|---|---|---|---|
| MX | yourdomain.com | mail.yourdomain.com | 10 |
| A | mail.yourdomain.com | YOUR_SERVER_IP | — |
Replace YOUR_SERVER_IP with the public IP address of your MXHook server.
How It Works
When someone sends email to user@yourdomain.com:
- The sender's mail server looks up the MX record for
yourdomain.com - The MX record points to
mail.yourdomain.com - The A record resolves
mail.yourdomain.comto your server's IP - The sender connects to your server on port 25 and delivers the email
- MXHook accepts, parses, routes, and delivers it as a webhook
Multiple Domains
MXHook supports receiving email on multiple domains. Add MX records for each domain pointing to the same server, and register each domain via the API:
bash
curl -X POST http://localhost:8080/domains \
-H "X-API-Key: your-api-key" \
-d '{"name": "domain-one.com"}'
curl -X POST http://localhost:8080/domains \
-H "X-API-Key: your-api-key" \
-d '{"name": "domain-two.com"}'Verification
After setting up DNS, verify the MX record is propagated:
bash
dig MX yourdomain.com +shortExpected output:
10 mail.yourdomain.com.Then verify the A record:
bash
dig A mail.yourdomain.com +shortExpected output:
YOUR_SERVER_IPTroubleshooting
MX record not resolving
- DNS propagation can take up to 48 hours. Most providers propagate within minutes.
- Verify you're editing the correct DNS zone.
Email not arriving
- Ensure port 25 (TCP) is open in your firewall and cloud provider security group.
- Many cloud providers (AWS, GCP, Azure) block inbound port 25 by default. You may need to request an exception.
- Check MXHook logs for connection attempts.
Rejected at SMTP level
- Make sure the recipient's domain is registered in MXHook via
POST /domains.