MX: mail exchange
MX records tell a sending SMTP server where to deliver mail for a domain. Each MX carries a numeric preference; the lowest number is tried first.
In one line:
example.com. MX 10 mx1.mailprovider.com.
└── mail for ┘ └type┘ └#┘ └── goes to this server (lowest # first)What it holds#
A preference number (16 bits on the wire) and a hostname the sender resolves next for A/AAAA. The hostname cannot be a CNAME (RFC 2181 §10.3). Lowest preference is tried first; equal preferences tie-break at the sender's discretion (RFC 5321 §5.1).
mx.example.isitdns.net. MX 10 mx.example.com.When to use it#
- For any domain that receives mail. The apex is the typical place, but you can have MX at any name (for departmental routing, e.g.,
sales.example.com). - For backup MX in front of an on-prem mail server: a higher-preference MX at a hosted service that queues during outages.
When not to use it#
- For a domain that doesn't send or receive mail: publish a null MX instead (see Gotchas). Easier than fighting senders that keep retrying for days.
- For load balancing: preference is a discrete ranking, not a weighted load distribution. Use equal-preference for round-robin instead.
dig example#
Asks which servers take mail for mx.example.isitdns.net.
dig @1.1.1.1 mx.example.isitdns.net MXGO NOERROR, one MX record, preference 10
NO GO NOERROR with no answer, which means senders fall back to this name's A/AAAA
RFC: RFC 1035 defines the MX record; RFC 5321 §5.1 defines how a sender uses it.
Gotchas#
- The MX target must resolve to an A or AAAA record, not a CNAME (RFC 2181 §10.3) or a bare IP.
- No MX does not mean no mail. With no MX at all, senders fall back to an implicit MX: the domain's own A/AAAA record, treated as a mail server with preference 0 (RFC 5321 §5.1).
- Null MX for non-mail domains: RFC 7505 says a domain that never receives mail should publish a single MX record with preference 0 and a target of
.(literal dot):
example.com. MX 0 .Senders interpret this as "do not deliver here" and bounce immediately rather than retrying for days.
- SPF/DKIM/DMARC are separate: having an MX does not authorize anyone to send on your behalf. See email-records.