An MX record is a DNS resource record (type 15) that directs email delivery to a designated mail server instead of the domain's regular A record. When someone sends an email to a user at your domain, the sender's mail server queries DNS for MX records to find where to deliver the message.
Each MX record contains two parts: a preference number (0–65535) and a mail server hostname. The preference number sets priority—lower numbers are tried first. Multiple MX records enable failover: if the primary mail server is down, the sender tries the next one in order.
Example:
example.com. 3600 IN MX 10 mail1.example.com.
example.com. 3600 IN MX 20 mail2.example.com.
mail1.example.com. 3600 IN A 203.0.113.10
mail2.example.com. 3600 IN A 203.0.113.11
Mail is attempted first to mail1.example.com (preference 10). If that fails, delivery moves to mail2.example.com (preference 20).
Key rules:
- The MX target must resolve to an A or AAAA record, never a CNAME. Pointing an MX to a CNAME can break mail delivery.
- MX records themselves never contain IP addresses—they always reference a hostname.
- If no MX record exists, some mail servers fall back to the domain's A record, though this is rare and unreliable.
Use the MX lookup tool to check your domain's MX configuration. Proper MX setup is essential for email to reach your domain.
TipLower priority numbers win: the smallest number is tried first. Point MX records at a hostname with A/AAAA records, never at an IP address or a CNAME.