MX record
mail exchanger record / MX priority / null MX
An MX record is the DNS record that names the mail servers accepting email for a domain, and senders try the lowest priority number first. If a DNS move drops it, senders try the domain's own A or AAAA address, often the website's server, and if nothing there accepts mail, may keep retrying for about a week.
When someone emails an address at a domain, the sending mail server looks up that domain's MX records first. Each record names a mail server and gives it a priority number. RFC 5321, the standard for moving email between servers, says lower numbers are preferred. The sender tries the servers in order until delivery succeeds, so a record with a higher number acts as a backup. Servers that share a number get mail spread across them at random.
The standard also covers a domain with no MX record at all. The sender treats the domain's own address, its A or AAAA record, as the mail server. Cloudflare's DNS docs say virtually all zones on its full setup are expected to have at least one address record pointing to where the website or application is hosted. When the domain's own address record is that one, mail falls back to the web server. RFC 7505 says that when no mail server is listening at that address, delivery is retried for typically a week. If the domain has no usable address either, RFC 5321 says the failure must be reported as an error. Once any MX record exists, the standard forbids falling back to the address record.
Delayed mail sits in a queue on the sender's side. RFC 5321 says retries should generally come at least 30 minutes apart, and the give-up time generally needs to be at least 4 to 5 days. RFC 7505 adds that this delays the notice to the sender that the mail went astray.
The value in an MX record must be a hostname, and that hostname must return an address for the mail server. RFC 5321 puts a hostname that answers with a CNAME alias outside the standard, and Cloudflare calls it forbidden. A domain that neither sends nor receives mail can publish a null MX, a single record with priority 0 and a dot as the server. That makes delivery attempts fail at once. RFC 7505 warns that a domain sending mail with a null MX risks having its mail rejected.
In practice
A dental office moves its website to a new host, which takes over DNS by changing the nameservers. The records the new host set up include the website but miss the MX records for the office email provider. Patient emails fall back to the domain's address record, which points at the web server, and nothing there accepts mail. Most senders keep retrying, so few bounces come back, and the office sees a quiet inbox for three days. Restoring the MX records then lets most of the 30 queued emails arrive, because RFC 5321 has senders retry until the message is transmitted or they give up. The figures are a worked example.
Not the same as
- SPF record
- An SPF record declares which hosts are authorized to use the domain name in the HELO and MAIL FROM (envelope sender) identities of mail. An MX record names the servers that receive mail for it.
Why it matters to you
A missing MX record stalls inbound email while the website keeps working, so nothing looks broken. Cloudflare says its automatic record scan can miss records, and tells customers to always review their DNS records and add any missing ones before changing nameservers. Check the MX records in that review, because a missing one does not show on the website.
What to ask or check
- 01Which company hosts the DNS for your domain, and who at the business can log in there?
- 02Before a website or DNS move, who will copy your MX records and compare them with the old DNS host?
- 03Do the live MX records match what your email provider tells you to publish?
- 04Does the business own domains that neither send nor receive mail, and should they publish a null MX record?
What people get wrong
That a missing MX record always makes email bounce right away. With no MX record, senders try the domain's A or AAAA address. If no mail server is listening there, RFC 7505 says delivery is retried for typically a week before the sender gives up, so the sender may not hear about the failure for days.
Red flags
- A DNS move that relies on an automatic record scan, with no record-by-record check against the old DNS host, including the MX records.
- An MX record whose value is an IP address, or a hostname that is itself a CNAME alias.
- A null MX record on a domain the business sends email from.