What is an MX record?
An MX record, short for mail exchange record, is a DNS entry that names the mail server responsible for accepting email for a domain. When someone sends a message to an address at your domain, their mail server queries DNS for your MX records to learn where to deliver it. Each record holds two pieces of information: a priority number and the hostname of a server that handles your inbound mail.
Every domain that receives email needs at least one MX record. Without one, other mail servers have no published destination for your incoming messages, and delivery either fails or falls back to behavior you did not intend.
How mail routing uses MX priority
The lookup happens in real time as mail is sent. The sending server reads the recipient domain, fetches its MX records, and connects to the host with the lowest priority number first. Priority is a preference value, so a lower number means a more preferred server. RFC 5321 defines this behavior as part of the SMTP standard.
- Lowest number wins. A record at priority 10 is tried before one at priority 20. The values are relative, so only their order matters, not the exact numbers.
- Equal priorities share load. When two hosts carry the same priority, sending servers pick between them at random, spreading inbound mail across both.
- Failover is automatic. If the preferred host refuses the connection or times out, the sending server moves on to the next priority in line.
- Hostnames, not addresses. An MX target must be a hostname that resolves through an
AorAAAArecord. RFC 5321 does not permit an IP address literal as an MX target.
Multiple MX records and redundancy
A domain can publish as many MX records as it needs, and most production setups use at least two. A second mail exchange at a higher priority number acts as a backup: if the primary is unreachable, sending servers queue and retry against the secondary instead of bouncing the message. Many managed providers handle this redundancy for you behind a single hostname, which is why a one record setup is not always a problem.
When you do run your own backups, leave gaps in the priority numbers, such as 10 and 20, so you can slot a new server in between later without renumbering everything.
Common MX mistakes
- Pointing an MX at a CNAME or a bare IP. The target must be a hostname with its own address record. A CNAME or an IP literal breaks strict senders and is disallowed by RFC 5321.
- A single MX with no backup. One host is a single point of failure. If it goes down, inbound mail waits in sending queues until it comes back.
- Hostnames that do not resolve. If an MX target has no
AorAAAArecord, sending servers cannot connect and mail fails even though the MX record exists. - Stale records after a migration. Old MX entries left behind after switching providers can route mail to a server that no longer accepts it.
MX records only control where inbound mail is delivered. They say nothing about whether your outbound mail is trusted. Pair this lookup with the SPF record checker for sender authorization and the reverse DNS checker for PTR alignment on your sending IPs, then run the full sender reputation checker to grade everything together.