HTTPfy
10 Facts About DNS MX Records Every IT Admin Should Know

10 Facts About DNS MX Records Every IT Admin Should Know

An MX record tells other mail servers which hosts accept mail for your domain. That is its whole job. Most of the mail outages and bounce storms we see come from a handful of misunderstandings about how senders read those records, so this post lists the ten facts worth keeping in your head when you touch a zone file.

1. An MX record has two fields that matter: preference and target

Run a query against a domain you know:

$ dig MX gmail.com +noall +answer
gmail.com.    3600  IN  MX  5 gmail-smtp-in.l.google.com.
gmail.com.    3600  IN  MX  10 alt1.gmail-smtp-in.l.google.com.
gmail.com.    3600  IN  MX  20 alt2.gmail-smtp-in.l.google.com.
gmail.com.    3600  IN  MX  30 alt3.gmail-smtp-in.l.google.com.
gmail.com.    3600  IN  MX  40 alt4.gmail-smtp-in.l.google.com.

Each line holds the owner name, the TTL in seconds, the class, the type, then the two fields you care about: a preference number (0 to 65535) and the hostname of a mail server. In a zone file the same record looks like this:

example.com.  3600  IN  MX  10 mx1.example.com.

Watch the trailing dot. Without it, most DNS software appends the zone name, and mx1.example.com turns into mx1.example.com.example.com., a host that does not exist.

2. Lower preference wins, and equal values share the load

RFC 5321 section 5.1 tells the sending server to sort MX hosts by preference and try the lowest number first. If that host refuses the connection or times out, the sender moves to the next one. The numbers are relative: 10 and 20 behave the same as 1 and 2. Leave gaps so you can slot a host in later without renumbering.

When two records share a preference, the RFC asks senders to pick between them at random. That gives you crude load spreading for free:

example.com.  IN  MX  10 mx1.example.com.
example.com.  IN  MX  10 mx2.example.com.

3. A backup MX needs the same filtering as your primary

Spammers know the lowest-priority host often runs with weaker filtering, so they connect to it on purpose. If your backup MX accepts any recipient and queues the message, it will later try to hand junk to the primary, get rejected, and send bounces to forged senders. Mail admins call that backscatter, and it gets your IPs listed on blocklists.

A secondary MX should know your valid recipients and run the same spam and authentication checks as the primary. If you can't give it that, a single well-run host plus normal sender retries (fact 8) often serves you better.

4. The target must be a hostname with A or AAAA records

The target field holds a domain name, and that name must resolve to an address. Two common mistakes break this:

  • Putting an IP address in the target. MX 10 192.0.2.25 is invalid. DNS treats it as a hostname, and since no host called 192.0.2.25. exists, strict senders fail. Create mx1.example.com A 192.0.2.25 and point the MX at that name.
  • Pointing the MX at a CNAME. RFC 2181 section 10.3 says an MX target must not be an alias. Many large senders tolerate it, others refuse, and you get delivery that works for some people and fails for others. Point the MX at the canonical name.

Check both steps with dig:

$ dig +short MX example.com
10 mx1.example.com.
$ dig +short A mx1.example.com
192.0.2.25
$ dig +short CNAME mx1.example.com
$ # no output: mx1 is not an alias

A DNS record card resolving to a mail hostname and then to an address, with a broken loop showing an invalid alias

5. No MX record does not mean no mail

If a domain has no MX records, RFC 5321 tells senders to treat the domain's own A or AAAA record as an implicit MX with preference 0. So if example.com has an A record pointing at your web server and no MX, the internet will try to deliver mail to your web server on port 25.

That surprises people who park a domain or use it only for a website. Either publish a real MX or publish a null MX (fact 6).

6. Null MX says "this domain takes no mail"

RFC 7505 defines a single record that stops senders from trying:

example.com.  IN  MX  0 .

The target is the DNS root, a lone dot. A sender that sees it gives up at once and reports 556 5.1.10 to its user, instead of queueing the message for days. The null MX must be the only MX record at that name.

Pair it with an SPF record of v=spf1 -all and a DMARC policy of p=reject if the domain sends no mail either. RFC 7505 warns against publishing a null MX for any domain you use in envelope or From addresses, because receivers may reject mail from a domain that can't receive replies.

7. "Propagation" means caching, and the TTL controls it

DNS changes don't spread across the internet. Resolvers cache your old answer for the length of its TTL, then fetch a fresh one. If your MX records carry a TTL of 86400, some senders will keep using the old server for up to a day after you change them.

Before a mail migration, lower the MX TTL to 300 and wait for the old TTL to expire. Make the switch, confirm mail flows, then raise the TTL again. The "wait 48 hours" rule of thumb comes from long default TTLs at registrars, not from DNS itself.

Negative answers get cached too. If a resolver asked for your MX before you created it, it may remember "no such record" for the time set in your SOA record's minimum field (RFC 2308).

8. Senders retry, so a short outage delays mail

SMTP was built for unreliable links. When a sender can't reach any MX host, or gets a 4xx temporary error, it queues the message. RFC 5321 section 4.5.4.1 suggests waiting at least 30 minutes between attempts and keeping the message for at least four to five days before bouncing it.

An hour of downtime on your only MX delays incoming mail by that hour plus each sender's retry interval. A 5xx permanent error is different: the sender bounces the message right away. During maintenance, make your server return 4xx codes or stop listening.

9. MX handles inbound mail, SPF, DKIM and DMARC handle outbound trust

MX records say where to deliver mail for your domain. The authentication records protect mail you send:

  • SPF (RFC 7208) is a TXT record listing servers allowed to send with your domain in the envelope sender (MAIL FROM). It has an mx mechanism that authorizes your MX hosts as senders. Use it only if those same hosts send your outbound mail. If Microsoft 365 receives your mail and a marketing platform sends it, mx authorizes the wrong machines.
  • DKIM adds a cryptographic signature to each message. Receivers fetch your public key from a TXT record at selector._domainkey.example.com.
  • DMARC is a TXT record at _dmarc.example.com. It tells receivers what to do when a message fails both SPF and DKIM alignment with the visible From domain: p=none, p=quarantine or p=reject. In May 2026 the IETF published RFC 9989 as the new DMARC standard, replacing RFC 7489. Existing v=DMARC1 records keep working.

SPF limits you to 10 DNS lookups per evaluation. Each mx mechanism costs one lookup, and RFC 7208 returns a permanent error if the mx lookup returns more than 10 hosts. A long MX list combined with several include: entries can push you over the limit and fail SPF for every message.

Google and Yahoo have required SPF, DKIM and a DMARC record from bulk senders since February 2024, and Microsoft started enforcing the same set for Outlook.com, Hotmail and Live addresses on May 5, 2025. MX doesn't affect any of that, but your DMARC aggregate reports (rua=mailto:...) need a working MX at the reporting address.

An envelope linked to a key, a seal, and a shield with a check mark, standing for DKIM, SPF and DMARC

10. Test the server behind the record

A correct MX record pointing at a dead server still bounces mail. After any change, test each layer:

# 1. What do public resolvers return?
$ dig @1.1.1.1 MX example.com +short
$ dig @8.8.8.8 MX example.com +short

# 2. What does your authoritative server return? (bypasses caches)
$ dig MX example.com @ns1.example.com +norecurse

# 3. Does the host answer SMTP and offer TLS?
$ openssl s_client -starttls smtp -connect mx1.example.com:25 -crlf -quiet

If step 1 and step 2 disagree, you are waiting on a TTL. If step 3 hangs, check firewalls and whether your hosting provider blocks port 25, which many cloud providers do by default.

Quick checklist

  • Each MX target is a hostname with an A or AAAA record, never an IP or a CNAME.
  • Targets end with a trailing dot in zone files.
  • Backup MX hosts run the same recipient checks and spam filtering as the primary.
  • Domains that take no mail publish MX 0 ., and parked domains don't fall back to a web server's A record.
  • MX TTL drops to 300 a day before a migration.
  • SPF uses mx only when the MX hosts send your mail, and stays under 10 lookups.
  • DMARC sits at _dmarc and its report address can receive mail.

You can run these checks from a browser with our DNS query tool, which shows MX, A, TXT and other records side by side.