What is an MX Record? Technical Guide to Mail Exchange
Mail Exchange (MX) records route email through priority weightings and multi-server redundancy — here's the mechanics behind it.
Mail Exchange (MX) Records Explained
An MX (Mail Exchange) record is a critical resource record in the Domain Name System that specifies the mail servers responsible for accepting incoming email messages on behalf of a domain.
When a sender transmits an email to `user@example.com`, the sender's Mail Transfer Agent (MTA) performs a DNS MX query for `example.com` to determine the destination SMTP hosts.
Anatomy of an MX Record
; Domain Name TTL Class Type Priority Target Host
example.com. 3600 IN MX 10 mail1.example.com.
example.com. 3600 IN MX 20 mail2.example.com.- Host/Name: The domain receiving email (`@` or `example.com`).
- Priority: A 16-bit integer (0–65535) indicating preference. Senders must attempt delivery to the lowest priority number first.
- Target: The Fully Qualified Domain Name (FQDN) of the mail server.
Best Practices for MX Redundancy
- Deploy at least two MX endpoints: Primary and secondary servers ensure continuous inbound queueing even during maintenance.
- Never target a CNAME: RFC 2181 explicitly states that the target of an MX record must resolve directly to an A or AAAA record.
- Verify matching Reverse DNS (PTR): Mail servers connecting to outbound MTAs must have valid matching PTR records to prevent spam rejection.
Example: A Two-Server MX Setup (Illustrative)
example.com. 3600 IN MX 10 mail1.example.com.
example.com. 3600 IN MX 20 mail2.example.com.Sending servers try `mail1` (priority 10) first. If it doesn't answer within its connection timeout, they fail over to `mail2` (priority 20) — this is what "redundancy" actually means for MX records: a documented fallback order, not load balancing.
Check Your MX Records
Inspect your current MX priorities and verify mail server reachability with our DNS Record Checker and Port Scanner for ports 25, 465, and 587.
Guide FAQs
Key takeaways and technical clarifications.
Related Diagnostic Tools
Combine diagnostics for deep-dive network and DNS troubleshooting.