MX records explained
Every email that reaches a domain gets there because of a DNS lookup. The sending mail server asks DNS a single question — which host accepts mail for this domain? — and the MX records are the answer. Get them wrong and inbound mail fails in ways that are invisible from the inside, because your own internal mail keeps working perfectly.
What an MX record contains
An MX record has exactly two fields: a preference value and the hostname of a mail exchanger.
example.com. 3600 IN MX 10 mx1.example-mail.net.
example.com. 3600 IN MX 20 mx2.example-mail.net.
Read that as: mail for example.com should be delivered to mx1.example-mail.net, and if that host cannot be reached, try mx2.example-mail.net.
The preference number is a priority, and lower means more preferred. This trips people up constantly, because in most systems a higher number means higher priority. In MX records, 10 beats 20. The absolute values carry no meaning of their own; only the ordering matters. Administrators use 10/20/30 purely by convention, leaving gaps so a host can be inserted later.
When two records share the same preference value, a sender is expected to distribute between them, which is the standard way to load-balance across two equal gateways.
How a sending server actually uses them
When a mail server has a message for user@example.com, it:
- queries DNS for MX records of
example.com; - sorts the results by preference, lowest first;
- resolves the chosen exchanger's hostname to an A or AAAA record;
- opens a TCP connection to port 25 on that address and begins the SMTP conversation;
- on connection failure or a temporary error, moves to the next exchanger in the list and eventually retries the whole process later.
This retry behaviour is why a mail server being down for an hour does not usually lose mail: the sender queues the message and tries again, typically for several days before giving up with a delivery failure.
Implicit MX: when there are no MX records
RFC 5321 says that if a domain has no MX records, the sender should fall back to the domain's A or AAAA record and treat that host as the mail exchanger with preference 0. This is called implicit MX.
So a domain with no MX but a working web server may still receive mail — if something is listening on port 25 at the web server's address, which usually it is not. In practice, "no MX records" on a business domain nearly always means inbound mail is broken, and any verifier should treat it as a serious warning.
Null MX: declaring that a domain sends no mail
RFC 7505 defines a way for a domain to say explicitly that it accepts no mail: a single MX record with preference 0 and a target of a lone dot.
nomail.example.com. 3600 IN MX 0 .
A sender that sees this must reject the message immediately rather than queueing and retrying for days. This is genuinely useful for domains you own but never use for mail — parked domains, domains registered defensively, domains used only for web hosting — because it stops them accumulating queued spam and gives senders a fast, unambiguous failure.
From a verification perspective a null MX is the cleanest possible invalid result: no probing needed, the domain itself has declared the answer.
The rules people break
Pointing an MX record at a CNAME
The target of an MX record must be a hostname that resolves directly to an address record. RFC 2181 is explicit that it must not point at a name that is itself a CNAME alias. Some mail servers follow the chain anyway; others do not, and the result is mail that works from some senders and fails from others — one of the most frustrating classes of bug to diagnose.
Pointing an MX record at an IP address
The MX target is a domain name, not an address literal. MX 10 192.0.2.25 is invalid. The record needs to name a host, and that host needs its own A or AAAA record.
Leaving a stale exchanger in the list
After a mail migration, the old provider's exchanger is often left in place at a higher preference number "just in case". Once that host stops accepting mail for the domain, every message that reaches it during a primary outage is rejected or lost. Remove retired exchangers rather than demoting them.
Forgetting that MX and SPF are separate problems
MX governs inbound mail. SPF, DKIM and DMARC govern outbound authentication. Changing your MX records does not update your SPF record, and a mail migration that updates one but not the other produces a domain that receives mail fine while its outgoing mail starts failing authentication.
Check an address before you send to it
Mailcheq runs syntax, MX, disposable, role-account and live SMTP checks in the browser, free.
Verify an address →TTL and why migrations go wrong
Each MX record carries a time-to-live telling resolvers how long to cache it. A TTL of 3600 means senders may use the old answer for up to an hour after you change it.
The standard migration procedure is to lower the TTL to something short — 300 seconds is typical — at least one full TTL period before the change, make the change, confirm propagation, then raise the TTL again. Lowering it at the same moment you make the change does nothing, because resolvers are already holding the old record with the old, long TTL.
During any migration both old and new systems should accept mail, because for a period some senders will be using cached records.
Checking MX records yourself
On any Unix-like system:
dig +short MX example.com
host -t MX example.com
On Windows:
nslookup -type=MX example.com
Or use our MX record lookup tool, which resolves the exchangers and shows their addresses in one step. When you are debugging why mail to a domain fails, the first three things to establish are: do MX records exist, do their targets resolve, and does anything answer on port 25 at those addresses.
What MX records tell a verifier
MX resolution is the second stage of the verification pipeline, and it is the one that produces the highest-confidence negatives. If a domain has a null MX, or has no MX and no mail-capable address record, then every address on that domain will bounce — no probing required, no ambiguity.
The reverse does not hold. Healthy MX records mean the domain can receive mail. They say nothing about whether a particular mailbox exists, which is why the SMTP probe stage exists at all, and why a catch-all domain remains genuinely ambiguous even when its MX setup is perfect.
Spotted an error on this page? Email hello@mailcheq.com and we will fix it.