DNS MX Record: Mail Servers & Priority Explained
A DNS MX (Mail Exchanger) record tells the internet which servers accept email for a domain. When a mail server has a message for [email protected], it looks up the MX records for example.com and delivers to the host with the highest priority. Without a valid MX record, a domain cannot reliably receive email.
What is an MX record?
Defined in RFC 1035 and governed by the mail standard RFC 5321, an MX record maps a domain to one or more mail servers, each with a priority value. Sending servers try the lowest priority number first, using the higher ones as fallbacks.
MX record structure and example
example.com. 3600 IN MX 10 mail1.example.com.
example.com. 3600 IN MX 20 mail2.example.com.
| Field | Meaning |
|---|---|
| Domain | The domain the email is addressed to (example.com). |
| Type | Always MX. |
| Priority | A number that sets delivery order. Lower means higher priority — 10 is tried before 20. Equal values share load. |
| Mail server | The hostname of a server that accepts mail. It must resolve via an A/AAAA record — not an IP address, and not a CNAME. |
How MX priority works
In the example above, sending servers deliver to mail1 (priority 10) first. If it is unreachable, they fall back to mail2 (priority 20). Two records with the same priority receive mail in a roughly even split, which spreads load across servers. This is why domains typically publish at least two MX records — one primary and one backup.
How to check a domain's MX records
# dig (Linux/macOS)
dig example.com MX +short
# nslookup (Windows/cross-platform)
nslookup -type=MX example.com
To view MX records together with the SPF/DKIM/DMARC TXT records that also govern mail, run the domain through the free DNS lookup tool.
Common MX record problems
- MX pointing at an IP or a CNAME. The mail-server field must be a hostname backed by A/AAAA records. Pointing an MX at an IP address or a CNAME violates the standard and causes delivery failures.
- No backup MX. A single MX record is a single point of failure; if that server is down, mail bounces instead of queuing on a fallback.
- Priority misunderstood. Remember lower numbers win. Setting the primary to a higher number than the backup silently routes mail the wrong way.
- MX without matching SPF. Even with correct MX records, missing or wrong SPF/DKIM/DMARC records land your outbound mail in spam.
Related DNS records
Email depends on more than MX. The TXT record carries SPF, DKIM, and DMARC policy, the PTR record provides the reverse DNS that receivers check, and the A/AAAA records resolve the mail servers themselves.
Frequently asked questions
Which MX priority is used first — high or low?
The lowest number. Priority 10 is tried before 20. Lower value = higher preference.
Can an MX record point to an IP address?
No. The MX target must be a hostname resolvable via A/AAAA records. It also must not point to a CNAME.
Do I need more than one MX record?
It is strongly recommended. A second MX at a higher priority number acts as a backup so mail is not lost if the primary server is unavailable.