Learn/Email

MX records: where your domain’s email is delivered

MX records tell other mail servers where to deliver email for your domain. How to check them, set them, and fix common mistakes.

Want this checked on your own domain?

Join the waitlist

Updated

Message for whoever manages your DNS

Hi, could you check our domain’s MX records against our email provider’s current setup instructions?

Please make sure they list only our current provider’s mail servers, exactly as the provider documents them, and remove any records left over from a previous provider. If this domain should never receive email, please replace them with a single null MX record (priority 0, server “.”).

Thank you.

Want this checked on your own domain? Join the waitlist.

Check yours

The MX lookup (join the waitlist for access) shows your MX records in the order senders try them, which provider runs those servers, and whether each one exists. The full domain report checks them along with SPF, DKIM, DMARC, and the rest of your domain.

Fix it

MX records live in your DNS, at the root of your domain. In most DNS hosts the host (or name) field is “@” or left blank. Each record has two parts: a priority number and the name of a mail server. Senders try the lowest number first.

Your email provider publishes the values to use. Copy them exactly. As an example of the shape, with placeholder server names:

TypeHostPriorityValue
MX@10mx1.example.net
MX@20mx2.example.net

The same records in zone-file form:

example.com.  3600  IN  MX  10 mx1.example.net.
example.com.  3600  IN  MX  20 mx2.example.net.

To set or correct them:

  1. Find your provider’s current MX values in its setup guide. For example, Google Workspace publishes a single record, smtp.google.com with priority 1, and still supports its older values that start with aspmx.
  2. In your DNS host, open the records for the domain and find the records of type MX at the root.
  3. Delete any MX record your provider didn’t give you.
  4. Add each record with the priority and server name exactly as given. Some DNS hosts want a trailing dot (smtp.google.com.) and others add it for you; follow your DNS host’s format.
  5. Save. Other servers may keep using the old records until the record’s TTL (time to live, the number of seconds a record may be cached) has passed (RFC 1035 §3.2.1). Google tells its customers to allow up to 72 hours.
  6. Run the MX lookup again to confirm what the world now sees.

Moving to a new email provider

The goal is that no message arrives at a server that can no longer hand it to you.

  1. Set up the new provider first: verify the domain with it and create every mailbox and alias, so it is ready to accept mail.
  2. Ahead of the switch, lower the TTL of your current MX records, for example to 3600 seconds (one hour). Then wait at least as long as the old TTL, so servers that cached the records pick up the shorter one.
  3. If your domain uses MTA-STS, add the new provider’s mail servers to the MTA-STS policy and update its id before you change MX. Senders that enforce a policy refuse to deliver to servers it doesn’t list (RFC 8461 §5, §8.1).
  4. Replace the MX records: delete all of the old provider’s records and add the new provider’s.
  5. Keep the old service running, and collect mail from it, until at least the TTL has passed. Senders that cached the old records keep delivering there until then.
  6. Update SPF and DKIM so the new provider is authorized to send as your domain, then remove the old provider once it no longer sends for you.
  7. Raise the TTL again if you lowered it, and confirm the result with the MX lookup.

If the domain never receives email

Publish a null MX: one MX record with priority 0 and the server name “.” (a single dot), and no other MX records (RFC 7505 §3).

example.com.  3600  IN  MX  0 .

Senders then refuse mail to the domain immediately instead of retrying for days (RFC 7505 §1). Pair it with an SPF record of v=spf1 -all and a DMARC policy of p=reject, as described in protecting domains that don’t send email. Don’t publish a null MX on a domain you send email from; see the domain says it receives no mail, but it sends mail.

Conflicting mail settings

What it means. The domain publishes a null MX (priority 0, server “.”), which says “this domain accepts no mail”, alongside ordinary MX records that say the opposite.

Why it matters. RFC 7505 §3 says a domain that publishes a null MX “MUST NOT advertise any other MX RR”. The standard doesn’t say how senders handle the mix, so it depends on their software, and some may treat the domain as accepting no mail even though you have working mail servers.

Fix. Decide whether the domain should receive email.

  • If it should: delete the MX record whose server is “.”, and keep your provider’s records.
  • If it shouldn’t: delete every other MX record, and keep only 0 ..

Confirm. The MX lookup shows either only your provider’s servers or only the null MX.

The domain says it receives no mail, but it sends mail

What it means. The domain publishes a null MX, but its SPF record authorizes services to send email as the domain.

Why it matters. Replies, bounce messages, and delivery reports to your messages have nowhere to go. RFC 7505 §4.2 says mail systems “SHOULD NOT publish a null MX record” for domains they send from, because many receivers reject mail whose return address can’t receive mail. Receivers that do so are told to reply with code 550 and enhanced status 5.7.27, “Sender address has null MX” (RFC 7505 §4.1).

Fix.

  • If you send email from this domain: replace the null MX with your email provider’s MX records, so the domain can receive replies.
  • If you don’t: change the SPF record to v=spf1 -all, which says no server may send as the domain. See SPF.

Confirm. Run the full report again. A domain that neither sends nor receives should show a null MX together with v=spf1 -all.

The “no mail” record is malformed

What it means. The domain has an MX record whose server is “.”, the null MX target, but the record isn’t a valid null MX: its priority isn’t 0, or there is more than one such record.

Why it matters. RFC 7505 §3 defines the null MX as exactly one MX record with priority 0 and the server “.”. Senders that implement RFC 7505 look for that exact record; anything else isn’t recognized as “this domain accepts no mail”, so they may keep trying to deliver.

Fix. Replace the MX records with the single record 0 ., as in if the domain never receives email.

Confirm. The MX lookup shows one record, 0 ..

The domain has no mail servers

What it means. The domain has no MX records, but its SPF record authorizes services to send email as the domain. (A DMARC record alone doesn’t count: domains that send no mail publish one too, to lock themselves down.)

Why it matters. Without MX records, senders fall back to the domain’s own address records (A or AAAA), the same records a browser uses to reach a website at the domain, and try to deliver there (RFC 5321 §5.1). If the domain has no address records, mail bounces at once. If it has them but no mail server answers there, senders retry for a long period, “typically a week”, before giving up (RFC 7505 §1). Replies to your messages and bounce notices are lost or delayed, and many receivers reject mail from addresses that can’t receive replies (RFC 7505 §4.2).

Fix.

  • If people or systems should receive mail at this domain: add the MX records your email provider gives you, as described above.
  • If the domain should neither send nor receive email: add a null MX, change SPF to v=spf1 -all, and set DMARC to p=reject, as in protecting domains that don’t send email. A null MX on a domain whose SPF still authorizes senders raises the problem above.

Confirm. The MX lookup lists your provider’s servers, or the full report shows the domain as locked down against email spoofing.

Mail to this domain can’t be delivered

What it means. Every server named in your MX records is unusable: the name doesn’t exist, it has no address, or it points only to private or reserved addresses that can’t be reached from the internet.

Why it matters. An MX server name must lead to at least one address (RFC 5321 §5.1). When none of the listed servers is usable, senders must treat it as an error, so email to your domain bounces. This can happen after a change of email provider, when the old provider retires its servers, or because of a typing mistake in the record.

Fix. Replace all MX records with the ones your current email provider gives you. If you run your own mail server, give its name an A or AAAA record with its public address.

Confirm. The MX lookup shows every server as existing.

Some mail servers don’t exist

What it means. At least one server in your MX records has no usable address (it doesn’t exist, has no address records, or has only private or reserved addresses), while others work.

Why it matters. Senders try servers in priority order, lowest number first, and pick at random among equal numbers (RFC 5321 §5.1). Every sender that picks the broken server first fails there before moving on. The standard asks senders to try at least two addresses but lets them limit how many they try, so mail can arrive late or, with some senders, not at all.

Fix. Delete the MX records that point to those servers. They may be left over from a previous email provider. If a server is yours and should be in service, fix its address records instead.

Confirm. The MX lookup lists only servers that exist.

An MX record points to an IP address

What it means. An MX record’s value is an address such as 192.0.2.10 instead of a server name.

Why it matters. The value of an MX record is defined as a domain name (RFC 1035 §3.3.9), and that name “MUST return at least one address record” when looked up (RFC 5321 §5.1). A sender that follows the standard looks up 192.0.2.10 as if it were a name, finds nothing, and can’t use the record.

Fix. Use your provider’s documented server name. If the server is your own, give it a name and point the MX at the name:

mail.example.com.  3600  IN  A   192.0.2.10
example.com.       3600  IN  MX  10 mail.example.com.

Confirm. The MX lookup shows a server name for every record.

An MX record points to an alias

What it means. An MX record names a server that is itself an alias (a CNAME record) for another name.

Why it matters. RFC 2181 §10.3 says the name in an MX record “must not be an alias”. RFC 5321 §5.1 places such records outside the standard, so whether a sender follows the alias depends on its software. Aliases also cost every sender extra lookups, because DNS servers don’t include the alias target’s addresses with the MX answer (RFC 2181 §10.3).

Fix. Point the MX record at the final server name. For example, if mail.example.com is an alias for mx.example.net, change the MX value to mx.example.net. If the name is yours, you can instead replace its CNAME with A or AAAA records.

Confirm. The MX lookup no longer reports an alias. dig +short CNAME mail.example.com returns nothing for the server name.

Technical reference

Record format

An MX record holds a 16-bit preference (0 to 65535; lower values are preferred) and an exchange, the domain name of a host willing to accept mail for the owner name (RFC 1035 §3.3.9). The owner name is the domain in the email address, so user@sub.example.com uses the MX records of sub.example.com, not those of example.com.

How senders choose a server

RFC 5321 §5.1:

  • The sender looks up MX records for the domain. If the domain is an alias, it continues with the alias target. A “non-existent domain” answer is an error; a temporary DNS failure means the message is queued and retried.
  • If MX records exist, the sender sorts them by preference and must randomize among equal preferences. It must not use the domain’s own address records.
  • If no MX records exist, the domain is treated as having an implicit MX of preference 0 pointing to itself, so the sender uses the domain’s A or AAAA records. RFC 7505 §1 notes that this gives a record with “a different primary mission” an email meaning.
  • If MX records exist but none is usable, the sender must report an error.
  • The sender should try at least two addresses and may limit how many it tries.

Mail that can’t be delivered yet is retried. RFC 5321 §4.5.4.1 suggests at least 30 minutes between attempts and a give-up time of at least 4 to 5 days.

Null MX

RFC 7505 §3 defines the null MX as a single MX record with preference 0 and an exchange of “.” (the zero-length root name), and forbids any other MX record next to it. A sender that refuses a recipient because of a null MX should use reply code 556 with enhanced status 5.1.10; a receiver that refuses mail because the sender’s domain has a null MX should use 550 with 5.7.27 (RFC 7505 §4.1).

Rules for the server name

  • It must be a domain name that resolves to at least one A or AAAA record (RFC 5321 §5.1).
  • It must not be an alias (RFC 2181 §10.3).
  • If the domain uses MTA-STS, every MX host must match an mx: line in the policy, or senders that enforce the policy won’t deliver to it. See MTA-STS.

What the report checks

We query the MX records of the domain you enter, then the A, AAAA, and CNAME records of each server name. We don’t connect to the mail servers themselves.

FindingWhen we report it
Incoming mail is routed correctlyEvery server name resolves to at least one public address and none is an IP address or an alias.
The domain declares it receives no emailA null MX (preference 0, exchange “.”) with no other MX records, and an SPF record that authorizes no senders.
Conflicting mail settingsA null MX next to other MX records.
The domain says it receives no mail, but it sends mailA null MX, and an SPF record that authorizes at least one sender.
The “no mail” record is malformedAn MX record with the server “.” that isn’t a single record with priority 0.
The domain has no mail serversNo MX records, and an SPF record that authorizes senders. We also look up the domain’s own A and AAAA records to say where senders will try instead. A domain without such an SPF record gets no MX finding.
Mail to this domain can’t be deliveredEvery server name doesn’t exist, has no A or AAAA records, or has only non-public addresses (private, loopback, link-local, shared, documentation, multicast, or reserved ranges).
Some mail servers don’t existSome, but not all, server names fail in the same ways.
An MX record points to an IP addressA record’s exchange is written as an IPv4 or IPv6 address.
An MX record points to an aliasA server name has a CNAME record, or its address lookup was answered through an alias.
Some mail servers could not be checkedThe address lookups for some server names didn’t complete, so we can’t say whether they exist.
Mail settings could not be readThe MX lookup didn’t complete, for example because the domain’s nameservers didn’t answer. See nameservers.

When we recognize a provider from its server names, the report names it.

Sources

Want this checked on your own domain?

Join the waitlist
Domain Readiness

Free checks for email, website, DNS, and registration, with plain-English fixes.

Domain Readiness™ (domainreadiness.com) is a service of Riviera Learning, LLC.