Introduction
An MX (mail exchanger) record tells other mail servers where to deliver email for a domain. It lists one or more hostnames, each with a priority number, and senders try the lowest number first. MX records control inbound mail only. They play no part in SPF, DKIM or DMARC checks, except through SPF's optional mx mechanism.
A domain can have perfect MX records and fail DMARC everywhere, or have no MX at all and pass. This guide covers MX lookups, priority, the few places MX touches authentication (SPF mx, null MX, gateways and MTA-STS) and an MSP migration checklist. For the authentication side, start with the DMARC guide.
Key takeaways
- RFC 5321 says senders look up MX records first. If a domain has no MX records at all, senders fall back to its A or AAAA record as an implicit MX with priority 0.
- Lower priority numbers are tried first. Records with equal priority are tried in random order to spread load.
- MX records are not checked by DMARC. The only link to authentication is the SPF
mxmechanism, which costs DNS lookups under RFC 7208. - Domains that receive no mail should publish a null MX (
0 .) together withv=spf1 -alland DMARCp=reject. - If a client uses MTA-STS, every MX change must be mirrored in the
mx:lines of the policy file, or senders that enforce it will not deliver.
What is an MX record?
An MX record is a DNS record that names the server, or servers, that accept email for a domain. Each record has two parts: a preference number (the priority) and a hostname. A sending server that has a message for someone at the domain queries the MX records, picks a host and connects to it on port 25.
A typical record set looks like this:
clientco.co.uk. 3600 IN MX 10 mx1.mailhost.example.
clientco.co.uk. 3600 IN MX 20 mx2.mailhost.example.
The target must be a hostname, not an IP address. The hostname then needs its own A or AAAA record. RFC 5321, Section 5.1 defines this lookup, and it points to RFC 2181 for the rule that MX targets should not be CNAME aliases. Some providers tolerate a CNAME target, but do not rely on it.
What happens if a domain has no MX record?
The sender falls back to the domain's address records. RFC 5321 says that if the MX lookup returns no records, the domain "is treated as if it was associated with an implicit MX RR, with a preference of 0", pointing at the domain itself. If the domain has an A or AAAA record, a sender will try to deliver to that web server.
So "no MX" does not mean "no mail": a parked domain with a website still attracts delivery attempts to its web host. The fix is a null MX, covered below. The fallback applies only when no MX records exist. If MX records exist but none respond, the sender does not try the A record.
How do MX priority values work?
The lowest number wins. RFC 5321 states that "lower numbers are more preferred than higher ones". A sender tries the host with the lowest preference first and moves to the next number only if that host is unreachable or refuses the connection with a temporary error.
When two records share a number, the standard says senders "MUST randomize them to spread the load". So two records at priority 10 are a load-balancing pair, while 10 and 20 are a primary and a backup. The actual numbers carry no meaning beyond their order: 0 and 10 behave the same as 10 and 50.
| Record set | What senders do |
|---|---|
10 mx1, 20 mx2 |
Always try mx1 first; mx2 only when mx1 fails |
10 mx1, 10 mx2 |
Pick one at random for each delivery |
0 . (alone) |
Null MX: the domain accepts no mail; senders fail immediately |
| No MX, A record exists | Implicit MX: deliver to the A/AAAA address with priority 0 |
| No MX, no A/AAAA | Undeliverable: the address cannot receive mail |
Does an MX record affect SPF, DKIM or DMARC?
No, not directly. SPF checks the sending IP against the domain in the envelope sender (Return-Path). DKIM checks a signature against a public key in DNS. RFC 9989 DMARC checks that one of those passes for a domain aligned with the visible From address. None of them looks up MX records.
MX describes where mail arrives; authentication describes who may send. One platform often does both, which is why the two get muddled. A Microsoft 365 tenant can have correct MX records and still fail DMARC because DKIM was never enabled.
Where is the link between MX and SPF?
SPF has an mx mechanism. It authorises every IP address of every MX host for the domain. It is a shortcut for organisations whose inbound servers also send outbound mail:
clientco.co.uk. TXT "v=spf1 mx include:spf.protection.outlook.com -all"
The cost is DNS lookups. RFC 7208, Section 4.6.4 counts mx against the limit of 10 lookups per SPF evaluation. It also says each MX evaluation "MUST NOT result in querying more than 10 address records", or the result is permerror. On cloud platforms, mx is almost always wrong: Microsoft 365 and Google Workspace do not send outbound mail from their MX hosts, so it wastes a lookup. Use the provider's include: instead. SPF too many DNS lookups shows how to trim a record that is over the limit.
Can a missing or broken MX hurt deliverability?
It can, in one specific case. RFC 7505 lets receivers reject mail whose sender domain publishes a null MX, and says they should use reply code 550 with enhanced status code 5.7.27. Section 4.2 tells operators not to publish a null MX on domains used in sender addresses. A sending domain also needs a working MX to receive replies and bounces, so never put a null MX on a domain that sends mail.
What is a null MX and when should you use one?
A null MX is a single MX record with priority 0 and a target of . (the DNS root). It tells senders that the domain accepts no email at all, so they bounce the message immediately instead of queuing it. RFC 7505 defines it and says a domain with a null MX "MUST NOT advertise any other MX RR".
Use it on parked domains, defensive registrations and website-only domains that receive no mail. Pair it with SPF and DMARC records that say the domain sends nothing:
parked.example. MX 0 .
parked.example. TXT "v=spf1 -all"
_dmarc.parked.example. TXT "v=DMARC1; p=reject; rua=mailto:dmarc@msp.example"
The null MX alone does not stop spoofing, because attackers send from their own servers and never touch your MX. SPF -all and DMARC p=reject are what tell receivers to refuse forged mail. GOV.UK guidance on protecting domains that don't send email recommends the same three records, and notes that some DNS providers cannot publish a null MX. The full record set, including subdomains and reporting, is in should parked domains have a DMARC record.
What happens when the MX points at a security gateway?
The gateway receives the mail first, filters it and relays it to the mailbox platform. This is normal for Mimecast, Proofpoint and similar services, and the MX points at the gateway, not at Microsoft 365 or Google Workspace.
The authentication problem sits on the second hop. The mailbox platform sees the gateway's IP, not the original sender's, so its own SPF and DMARC checks can fail unless it is told to look past the gateway. How secure email gateways affect DMARC, SPF and DKIM explains the trust settings that fix this, and why DMARC fails with a gateway in front of Microsoft 365 covers Enhanced Filtering for Connectors.
Changing the MX does not close the old route. Attackers can still connect directly to the mailbox platform's own MX host, unless it only accepts mail from the gateway's IPs.
What are the MX records for Microsoft 365 and Google Workspace?
Copy the exact value from each platform's admin console. The formats below match the vendors' own documentation as of November 2026.
| Platform | MX target | Priority | Source |
|---|---|---|---|
| Google Workspace | smtp.google.com (single record) |
1 | Google: Set up MX records |
| Google Workspace (older accounts) | aspmx.l.google.com and alternates |
As set | Still supported; no change needed if mail works |
| Microsoft 365 (classic) | <domain-key>.mail.protection.outlook.com |
As shown in the admin centre | Microsoft: Add DNS records |
| Microsoft 365 (DNSSEC / DANE) | <domain-key>.<subdomain>.mx.microsoft |
0 after migration | Microsoft: How SMTP DANE works |
Google says any account can use the single smtp.google.com value, that legacy aspmx values still work, and that other MX records should be removed.
Microsoft is introducing mx.microsoft hostnames, which support inbound SMTP DANE with DNSSEC. Existing domains opt in with the Enable-DnssecForVerifiedDomain cmdlet and get the new MX value back. So never script an assumption that the target ends in mail.protection.outlook.com: read it from the Exchange admin centre or Microsoft Graph. Microsoft-specific DMARC setup is covered in DMARC for Microsoft 365 clients.
Why must MTA-STS mx: lines match the MX records?
Because senders that enforce MTA-STS refuse to deliver to any MX host not listed in the policy. RFC 8461 says that in enforce mode, sending servers "MUST NOT deliver the message to hosts that fail MX matching". A forgotten policy file turns an MX migration into an inbound outage at the strictest receivers.
The policy lives at https://mta-sts.<domain>/.well-known/mta-sts.txt. Each allowed host goes on its own mx: line, and a wildcard covers only one label:
version: STSv1
mode: enforce
mx: *.mail.protection.outlook.com
mx: clientco-co-uk.o-v1.mx.microsoft
max_age: 604800
.mail.protection.outlook.com matches clientco-co-uk.mail.protection.outlook.com. A pattern of .mx.microsoft would not match the newer Microsoft hostnames, because they have two labels in front of mx.microsoft (Microsoft's example is contosotest-com.o-v1.mx.microsoft). List the exact hostname the admin centre gives you, or a wildcard at the right level. Update the policy file and the id in the _mta-sts TXT record before you change the MX. What is MTA-STS covers the full setup.
How do I look up a domain's MX records?
Use dig on Linux or macOS, nslookup on Windows, or a web tool. Query the domain itself, not a www hostname, and check the result from more than one resolver after any change.
dig +short MX clientco.co.uk
dig +short MX clientco.co.uk @1.1.1.1
nslookup -type=mx clientco.co.uk
dig +short prints each record as priority and hostname. An answer of 0 . is a null MX. An empty answer means no MX records, so the implicit A/AAAA fallback applies. Then look up the A record of each MX host to confirm it resolves. Our DNS lookup tool runs the same queries against several public resolvers, and DNS lookup fundamentals for MSPs explains caching and propagation.
What should an MSP check when a client migrates mail platform?
MX cutover is the visible step, but the records around it cause most incidents. Work through this list for each client domain, including secondary domains:
- Inventory every domain in the old tenant, including accepted domains that only receive mail.
- Lower the MX TTL to 300 seconds a day or two before cutover, so a rollback is quick.
- Update MTA-STS first: add the new hosts to the
mx:lines alongside the old ones, change theid, and remove the old hosts only after the cutover is complete. - Publish the new MX records exactly as the new platform shows them, and delete the old ones in the same change.
- Update SPF: add the new platform's
include:, remove anymxmechanism that pointed at the old hosts, and keep the old include until the old platform stops sending. - Enable DKIM on the new platform before outbound mail moves, so DMARC passes from day one.
- Check gateways and connectors: if a gateway stays in front, update its delivery route; if it is removed, lock down any connector that trusted its IPs.
- Verify with
digfrom two resolvers, send test messages both ways and read the headers with the email header analyzer. - Watch DMARC aggregate reports for a week for sources that now fail SPF or DKIM.
Common MX mistakes
| Mistake | What breaks | Fix |
|---|---|---|
| Old MX left beside the new one | Some mail lands on the old platform at random or as backup | Delete every record the new platform does not list |
| MX target is an IP address | Invalid record; many senders refuse it | Point at a hostname with an A/AAAA record |
| MX target is a CNAME | Undefined behaviour under RFC 5321 and RFC 2181 | Use the canonical hostname |
| Null MX plus another MX | Conflicting signals; RFC 7505 forbids it | Keep only 0 . or only real hosts |
| Null MX on a sending domain | Receivers may reject outbound mail (550 5.7.27) | Remove it; use real MX records |
SPF mx on a cloud tenant |
Wasted lookups, possible permerror |
Replace with the provider's include: |
| MTA-STS not updated | Enforcing senders stop delivering | Update mx: lines and id before cutover |
| Parked domain with no MX | Implicit MX sends mail to the web server | Publish 0 ., SPF -all, DMARC p=reject |
Frequently asked questions
Does a domain need an MX record to send email?
No. Sending uses SPF, DKIM and DMARC records, not MX. However, a sending domain should normally receive replies and bounces, so it needs working MX records in practice. A domain that sends must never have a null MX, because RFC 7505 allows receivers to reject its mail.
What priority should I use for a single MX record?
Any number works when there is only one record, because priority only matters relative to other records. Use whatever the platform tells you, such as 1 for Google Workspace's smtp.google.com, and record that value in the client runbook so later audits do not flag it as drift.
Does DMARC check the MX record?
No. DMARC checks whether SPF or DKIM passed for a domain aligned with the visible From address, as defined in RFC 9989. MX records are never part of that evaluation. MX only matters to DMARC indirectly, through SPF's mx mechanism or through gateways that change the path mail takes.
How long does an MX change take to work?
It depends on the old record's TTL. Resolvers keep the cached answer until it expires, so lowering the TTL a day before the change shortens the switch. Google says MX changes can take up to 72 hours to be recognised. Check from several resolvers before declaring the cutover complete.
Next steps
Look up the MX records for every client domain, flag any parked domain without a null MX, and check that MTA-STS policies match. Then confirm SPF does not rely on mx for a cloud tenant. DMARC AI processes aggregate reports for each client domain, which makes it easy to spot a source that started failing after an MX or platform change.