MX record: the DNS record that says where a domain's email goes
An MX (mail exchanger) record tells other mail systems where to send email for your domain. Senders use it to find the next hop, the server that receives the message next. That server is often a relay, an SMTP server that passes mail on instead of being the final delivery system. If a domain has no MX record, senders fall back to the domain's A or AAAA records. If nothing listens there, delivery is typically retried for a week, which delays the failure notice.
What is in an MX record
An MX record has a name, a TTL (how long caches may keep the answer), a type, a priority and a target.
; name TTL type priority target
example.com. 3600 MX 10 mail.example.com.
- Name: the domain that receives mail.
- TTL: the cache time in seconds.
- Type:
MX. - Priority: the preference value. Microsoft's Windows DNS guidance gives 0 or 10 as the usual values.
- Target: the mail server's hostname, not its IP address.
An example MX record might use name @ (the zone apex), TTL Auto and priority 5. These are example values, not required ones.
The target needs its own address record, which the MX record points to:
mail.example.com. 3600 A 192.0.2.10
What should my MX record be?
The values depend on your email provider. Take them from the provider's own documentation or admin console. Microsoft 365 documents this target pattern with a TTL of 3600:
example.com. 3600 MX <preference> <MX token>.mail.protection.outlook.com.
The domain-specific value comes from the Microsoft 365 admin center. A lower preference number is used first. Microsoft says its record's preference should be lower than any other MX record, so mail reaches Exchange Online.
Multiple MX records are allowed, but one provider's documentation notes they can cause delivery problems. A single record pointing to one mail system avoids many of them.
MX records concern receiving mail. This page does not cover sending authentication; see SPF record.
How to look up and check your MX records
Look up your domain's MX records to list them. Or query them yourself:
dig MX example.com +short
nslookup -type=mx example.com
Resolve-DnsName -Name example.com -Type MX
For a zone that holds the record above, an illustrative answer line is:
10 mail.example.com.
Note the current MX records before you change them. Updating them to Microsoft 365 causes all email sent to the domain to arrive there. Once mail flows to the new system, MX records pointing to the old system should be removed.
What is a null MX?
RFC 7505 defines the null MX. A domain uses it to say it accepts no email: a single MX record with preference 0 and target ..
example.net. 3600 MX 0 .
Use a null MX only for a domain that neither receives nor sends mail. Mail systems SHOULD NOT publish a null MX for domains used in MailFrom or From addresses, because that mail risks being rejected. A domain with a null MX MUST NOT publish any other MX record.
To check the rest of your email setup, check your domain's email authentication.
References
- RFC 5321: Simple Mail Transfer Protocol, IETF, section 7
- RFC 7505: A "Null MX" No Service Resource Record for Domains That Accept No Mail, IETF, section 7
- External Domain Name System records for Microsoft 365 - Microsoft 365 Enterprise | Microsoft Learn, learn.microsoft.com
- Create DNS records for Microsoft using Windows-based DNS - Microsoft 365 admin | Microsoft Learn, learn.microsoft.com
- Set up email records ยท Cloudflare DNS docs, developers.cloudflare.com