MX records and how email finds its way
Updated
When someone sends an email to you@example.com, their mail server asks DNS for the MX (mail exchanger) records of example.com. Each record names a server that accepts mail for the domain, so the domain's web address and its mail can live in completely different places.
Priority
Every MX record has a priority number. The sender tries the lowest number first and moves on to the next only if that server cannot be reached. Records with the same number share the load. Having a second, higher-numbered server gives you a fallback when the first is down.
example.com. MX 10 mail1.example.net. example.com. MX 20 mail2.example.net.
Rules worth knowing
- An MX record points to a host name, never directly to an IP address
- That host name should have its own A or AAAA record, and should not be an alias (CNAME)
- If a domain has no MX records at all, senders fall back to the domain's own address record, which is rarely what you want
- A single MX record with priority 0 and the target . (a dot) is a null MX: it says the domain accepts no email, and senders stop at once instead of retrying
What goes wrong
Common faults are an MX pointing at a name that does not resolve, a mail server whose address is on a blocklist, and a server with no matching reverse DNS name. The mail server check looks at each of these for you.
Related
- DNS records explainedWhat the common DNS record types (A, AAAA, CNAME, MX, NS, SOA and TXT) do, and what a TTL means for changes.
- Email blocklists (DNSBLs)What a DNS blocklist is, how a server is checked against one, and what to do if a mail server is listed.
- SPF: who may send mail for a domainHow an SPF record lists the servers allowed to send email for a domain, and the mistakes that break it.
- A domain health checklist: what to check and whyThe handful of public records that say whether a domain is set up sensibly for email, registration and DNS, and what each one protects against.
- MTA-STS: making senders use encrypted deliveryWhat MTA-STS is, how its record and policy file work, and why testing mode comes before enforce.
- DANE: pinning a mail server's certificate in DNSWhat a DANE (TLSA) record says, why it only works with DNSSEC, and which record form mail senders use.