MX Record
What an MX Record Does
An MX record, short for mail exchange record, tells other mail servers which host accepts email for a domain. When someone sends a message to an address at example.com, the sending server looks up the MX records for that domain and delivers the message to one of the hosts listed there.
MX records control only where incoming mail for a domain goes. They say nothing about which servers may send mail on the domain's behalf, which is handled by separate records covered in the email category. Keeping that distinction in mind avoids a common source of confusion.
Format, Priority and Hostnames
An MX record has a name, a time to live, a priority (also called preference) and a target hostname. A typical entry looks like this:
example.com. 3600 IN MX 10 mail.example.com.
The priority is a number where lower values are tried first. A sending server contacts the host with priority 10 before one with priority 20, and it falls back to the higher number only if the first host cannot be reached. Two records with the same priority share incoming mail between them, while higher-numbered records act as backups.
The target must be a hostname, not an IP address. The hostname needs its own A or AAAA record that points to the mail server. This also means that changing a mail server's IP address does not require changing the MX record.
Common MX Record Mistakes
Most MX problems come from a few patterns:
- Pointing to an IP address. The target must be a name, so an address in this field is not valid.
- Pointing to a name with no address record. Senders cannot connect when the hostname does not resolve.
- Leaving old records after a move. When mail moves to a new provider, outdated MX entries can send messages to a server that no longer accepts them.
When you review MX records, check that each target resolves to a live server and that the priorities reflect the order you want. For how MX fits with the other record types, see DNS record types.
Frequently asked questions
What Does MX Priority Mean?
MX priority sets the order in which sending servers try mail hosts. Lower numbers are tried first, so a server with priority 10 receives mail before one with priority 20. The number has no meaning beyond this ordering, and only the relative values matter.
Can an MX Record Point to an IP Address?
No. The target of an MX record must be a hostname. Put a name such as mail.example.com there, and create an A record or AAAA record for that name that holds the IP address. Using an address directly in the MX field does not work with standard mail servers.