בס״ד

MX Lookup

An MX record names the mail servers that accept email for a domain and gives each one a priority number. Sending servers try the lowest number first. An MX lookup reads those records and resolves every mail server to its IP addresses, so you can see who actually hosts a domain's mail. DNSX shows the full flow with geolocation and ASN.

$ curl https://dnsx.dev/dns/mx/gmail.com # mail flow with IPs and geo
$ dig MX gmail.com +short

What is an MX record?

An MX record (mail exchanger) is a DNS resource record that names a host willing to accept SMTP mail for a domain. It has been part of DNS since RFC 1035 in 1987, and its delivery semantics are specified by RFC 5321. Each record carries exactly two values: a preference number, universally called priority, and the hostname of a mail server.

MX records are what let an email address and a website live in different places. example.com can have an A record pointing at a web host in one network while its MX records point at Google Workspace or Microsoft 365 in another. A sending mail server never looks at the A record of a domain that publishes MX records.

example.com.  3600  IN  MX  10  mail1.example.com.
example.com.  3600  IN  MX  20  mail2.example.com.
                        │        │
                    priority   target hostname (never a CNAME, never an IP)

What does MX priority mean, and is lower better?

Lower is better. A sending server sorts the MX records by preference and attempts delivery to the lowest number first, moving to the next value only when every host at the current value is unreachable. Priority 10 is tried before priority 20, and priority 0 is tried before both.

Only the order of the numbers matters. The size of the gap between them carries no meaning at all, so 10 and 20 behave identically to 1 and 2, or to 5 and 500. The convention of using multiples of ten exists only so that a new server can be slotted between two existing ones without renumbering the zone.

Two MX records that share a preference value are equal, and a sending server picks between them at random, which is how mail providers spread inbound load across a pool. Google Workspace publishes five hosts at preferences 1, 5, 5, 10 and 10 for exactly this reason. Microsoft 365 usually publishes a single host at preference 0, and relies on that host being an anycast address rather than on DNS for redundancy.

Where is this domain's mail actually hosted?

The MX hostname usually identifies the provider outright, and where it does not, the IP addresses behind it do. Resolving each MX target and reading the ASN that announces its addresses is the reliable way to answer this question. A domain can point its MX at a hostname in its own zone and still have every message handled by a third party.

MX hostname patternWho hosts the mail
aspmx.l.google.comGoogle Workspace
*.mail.protection.outlook.comMicrosoft 365 / Exchange Online
mx*.mail.icloud.comiCloud Mail with a custom domain
mx.zoho.com, mx2.zoho.comZoho Mail
mail.protonmail.ch, mailsec.protonmail.chProton Mail
in1-smtp.messagingengine.comFastmail
*.migadu.comMigadu
*.improvmx.comImprovMX (forwarding only, no mailboxes)
*.mimecast.comMimecast security gateway in front of the real host
*.pphosted.com, *.ppe-hosted.comProofpoint security gateway
*.messagelabs.comBroadcom / Symantec Email Security.cloud gateway
*.secureserver.netGoDaddy
*.emailsrvr.comRackspace Email

The bottom four rows in that table are security gateways, not mailbox hosts. When the MX points at Mimecast, Proofpoint or Email Security.cloud, inbound mail is filtered there and then relayed to the real mailbox provider, which DNS does not reveal. In that case the ASN behind the MX addresses tells you the filtering vendor, and the domain's SPF record is usually the better clue to who runs the mailboxes.

This is the part a plain MX listing cannot give you. DNSX resolves every MX target to its A and AAAA records and annotates each address with its city, country and announcing ASN, so the mail flow is visible end to end in one view.

See the mail flow resolved

Every MX host, every IP address behind it, with geolocation and ASN on each one.

Open the mail flow view

Can an MX record point to a CNAME or an IP address?

Neither is allowed. RFC 2181 section 10.3 states that the name in an MX record must be a canonical hostname with an address record, and must not be an alias. Sending servers that follow the rule strictly will treat a CNAME target as a configuration error and refuse to deliver. Others chase the alias and succeed. Inconsistent delivery across senders is the classic symptom.

An IP address in an MX record is invalid for a different reason: the field is defined as a domain name, so a literal like 203.0.113.10 is interpreted as a hostname, gets the zone origin appended, and fails to resolve. There is no bracket syntax that makes it work, and no widely deployed mail server that accepts it.

The MX target must also have a real address record for the address family the sender is using. An MX host with only an AAAA record is unreachable from an IPv4-only sending server, which is a genuinely common cause of one-way mail failures.

What is a backup MX, and do I still need one?

A backup MX is a secondary mail server published at a higher preference number than the primary. When the primary is unreachable, senders deliver to the backup, which queues the mail and relays it to the primary once it recovers.

For most domains the answer today is no. SMTP already has a queue: a sending server that cannot reach any MX host holds the message and retries, typically for four to five days before giving up, as RFC 5321 recommends. An outage shorter than that costs you delayed mail rather than lost mail, which is all a backup MX buys you anyway.

A third-party backup MX can actively make things worse. Spammers target the secondary precisely because it usually lacks the recipient list, the content filtering and the reputation data of the primary, so it accepts mail for non-existent users and then generates backscatter when the primary rejects it. If you run one, it must perform the same recipient validation and filtering as the primary, or it becomes the weakest link in the domain's mail security.

The pattern worth copying is redundancy inside a single provider: several MX hosts at the same or adjacent preferences, all of which can accept and store mail. Google Workspace, Microsoft 365 and Fastmail all publish that shape. For a domain that should never receive mail at all, publish a null MX instead. That is one record, example.com. IN MX 0 ., defined by RFC 7505, and it makes senders fail immediately rather than retry for days.

Frequently Asked Questions

What is an MX record?
An MX record names the mail servers that accept email for a domain, each with a priority number. Sending servers try the lowest priority number first.
Does a lower MX priority number mean higher priority?
Yes. Priority 10 is tried before priority 20. Only the order of the numbers matters, and the size of the gap between them means nothing.
Can an MX record point to a CNAME?
No. RFC 2181 requires an MX target to be a hostname with an A or AAAA record. Many mail servers will refuse delivery if it points at a CNAME.
Can an MX record contain an IP address?
No. The target of an MX record must be a hostname. An IP address there is invalid and will break delivery, because the field is defined as a domain name and the literal gets treated as one.
What happens if a domain has no MX record?
Sending servers fall back to the domain's A record, but most modern mail providers treat a missing MX record as a delivery failure or a spam signal.

Related Tools