MX Mail Exchange Flagship
Specifies the mail servers responsible for accepting email for a domain.
What it's for
An MX (Mail Exchange) record tells the world which mail server(s) are responsible for accepting email on behalf of a domain. When someone sends an email to [email protected], the sending mail server looks up example.com's MX records to find out where to actually deliver the message — it doesn't just guess based on the domain's A record.
MX records support priority, so a domain can list multiple mail servers with a preference order — useful for having a backup mail server if the primary is down, or for routing through different providers (a primary provider plus a spam-filtering gateway in front of it, for example).
No MX records means no email can be delivered to that domain, full stop — this is one of the most common "why isn't my email working" root causes.
Format & syntax
example.com. 3600 IN MX 10 mail1.example.com.
example.com. 3600 IN MX 20 mail2.example.com.
- Name — the domain email is addressed to (usually the apex, e.g.
example.com, not a subdomain) - TTL — cache duration
- Class —
IN - Type —
MX - Priority — a number where lower means higher priority.
10is tried before20. - Value — the hostname of the mail server, which must itself resolve to an A or AAAA record. The MX value cannot point to a CNAME — it must resolve directly, per RFC 2181.
Multiple MX records at the same priority are treated as equally preferred, and sending servers will typically load-balance or randomly choose between them.
How it's used in practice
- Third-party email hosting — pointing MX at Google Workspace, Microsoft 365, or a transactional email provider, so mail for your domain routes to their infrastructure instead of a server you manage yourself.
- Priority-based failover — a primary mail server at priority 10 and a backup at priority 20, so if the primary is unreachable, sending servers retry against the backup.
- Mail filtering gateways — MX pointed at a spam/security filtering service (like an inbound gateway), which then forwards clean mail on to the real mailbox server — the MX-listed host isn't always the final destination, just the first hop.
- No MX = no mail — some domains deliberately have no MX record (and sometimes an explicit "null MX" record,
0 .) to signal they don't accept email at all, which helps prevent bounce/backscatter spam and clarifies intent to other mail servers.
Common mistakes & gotchas
- Pointing MX at a CNAME — this is invalid per spec and many mail servers will refuse to deliver, or behave unpredictably. The MX target must resolve directly via A/AAAA.
- Forgetting to also configure SPF/DKIM/DMARC — MX controls inbound mail routing only. It has nothing to do with outbound deliverability or spoofing protection — those are handled by TXT records (SPF, DKIM, DMARC). A domain can have perfect MX setup and still have all its outbound mail land in spam because SPF/DKIM aren't configured.
- Wrong priority ordering — accidentally giving the backup server a lower number (higher priority) than the primary, silently routing all mail through the wrong path.
- Migrating email providers without updating MX — a classic outage: you switch from one provider to another but don't update the MX records (or update them too early/late relative to mailbox migration), causing mail to bounce or get "lost" mid-transition.
- Using an IP address as the MX value — invalid. MX must point to a hostname, never a raw IP address.
Comparison & FAQ
| Type | Purpose | Key difference from MX |
|---|---|---|
| TXT (SPF) | Declares which servers are authorized to send mail as your domain | Controls outbound authorization, not inbound routing |
| TXT (DKIM/DMARC) | Email authentication and anti-spoofing policy | Also outbound-focused, works alongside MX rather than replacing it |
| A / AAAA | What an MX hostname ultimately has to resolve to | MX is one layer of indirection on top of a normal address record |
What does the priority number in an MX record mean?
Lower numbers are higher priority. A record with priority 10 is preferred over one with priority 20 — sending servers try the lowest-numbered server first and fall back to higher numbers if it's unreachable.
Can an MX record point to an IP address?
No — MX must point to a hostname, which then needs its own A or AAAA record. Pointing MX directly at an IP is invalid per the DNS spec.
Why isn't my email working even though my MX record looks correct?
MX only controls where mail gets routed, not whether it's accepted once it arrives, and it has nothing to do with outbound deliverability. Check that SPF, DKIM, and DMARC are configured, that the mail server itself is actually running and reachable on port 25, and that nothing upstream (firewall, provider block) is silently dropping connections.
What is a "null MX" record?
A special MX record (0 .) that explicitly declares a domain does not accept email at all, per RFC 7505. It's used for domains that only exist for other purposes (like a bare API domain) to prevent misdirected mail and reduce backscatter spam.