Skip to content

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:

TypeNameValuePriority
MXyourdomain.commail.yourdomain.com10
Amail.yourdomain.comYOUR_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:

  1. The sender's mail server looks up the MX record for yourdomain.com
  2. The MX record points to mail.yourdomain.com
  3. The A record resolves mail.yourdomain.com to your server's IP
  4. The sender connects to your server on port 25 and delivers the email
  5. 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 +short

Expected output:

10 mail.yourdomain.com.

Then verify the A record:

bash
dig A mail.yourdomain.com +short

Expected output:

YOUR_SERVER_IP

Troubleshooting

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.

Released under the Apache 2.0 License.