What it is
An MX record (mail exchanger) names the servers that accept email for a domain. When someone sends mail to you@example.com, their server looks up the MX records for example.com, picks the one with the lowest preference number and connects to it over SMTP. MX is defined in RFC 1035, and the delivery rules are in RFC 5321.
example.com. 3600 IN MX 10 mx1.example.com.
example.com. 3600 IN MX 20 mx2.example.com.
The fields
| Field | Example | Meaning |
|---|---|---|
| Name | example.com. |
The domain mail is addressed to (the part after @) |
| TTL | 3600 |
Seconds resolvers may cache it |
| Type | MX |
Mail exchanger |
| Preference | 10 |
Lower is tried first; equal values share the load |
| Exchange | mx1.example.com. |
Hostname of the mail server |
The exchange must be a hostname with its own A or AAAA record. The field holds a domain name, so an IP address typed there is treated as a (nonexistent) name, and RFC 2181 forbids pointing MX at a CNAME. If a domain has no MX at all, senders fall back to its A/AAAA record (the "implicit MX"), which is rarely what you want.
Common setups
- Google Workspace: a single record,
MX 1 smtp.google.com.Older setups use five:aspmx.l.google.com(1),alt1andalt2.aspmx.l.google.com(5),alt3andalt4.aspmx.l.google.com(10). Both still work. - Microsoft 365: one record,
MX 0 example-com.mail.protection.outlook.com., where the first label is your domain with dots replaced by dashes; copy the exact value from the admin center. - Domains that never receive mail: publish a null MX,
example.com. MX 0 .(RFC 7505), so senders bounce immediately instead of retrying for days. - A filtering service in front of your mailbox: the MX points at the filter, which relays to your real provider.
MX only covers receiving. Sending is authenticated by SPF, DKIM and DMARC records.
How to check it
Use our DNS Lookup, or check MX, SPF, DKIM and DMARC together with the Email Checker. From a terminal:
dig example.com MX +short
nslookup -type=MX example.com
After switching providers, the DNS Propagation Checker shows whether public resolvers still hand out the old servers.
Common mistakes
- MX on the wrong name. Mail for
you@example.comuses the MX ofexample.com, notmail.example.comorwww. - Old and new provider mixed. Leftover records from the previous host at a lower number keep receiving part of your mail. Delete them.
- Pointing at an IP or a CNAME. Some senders tolerate it, many don't.
- A missing trailing dot in a zone file, which turns
mx1.example.comintomx1.example.com.example.com. - Changing MX with a long TTL. Mail keeps going to the old server until caches expire; lower the TTL beforehand and keep the old mailbox running for a while.
Related record types
- TXT record: where SPF and DMARC live.
- SPF record: which servers may send for the domain.
- A record: what each mail server name must resolve to.
- PTR record: reverse DNS for sending servers.