An MX record (Mail Exchanger) defines the mail routing destination for a domain within the SMTP protocol. It maps a domain name to a list of message transfer agents (MTAs) authorized to accept email. Unlike A records, an MX record must point to a fully qualified domain name (FQDN) rather than a raw IP address.
Each record contains two primary components: a preference (priority) value and a host address. The preference is a numeric value where a lower number indicates higher priority. If the primary server is unreachable, the sending MTA attempts delivery to the server with the next lowest preference value.
How it works
When a sender transmits an email to user@example.com, the sending server queries the DNS for MX records of example.com. The DNS returns the list of configured hosts. The sender then performs a secondary A or AAAA record lookup for the chosen host to resolve its IP address and establish a TCP connection on port 25.
Configuration example: IN MX 10 mail.example.com. In this case, 10 is the priority. Setting multiple records with equal priority allows for basic load balancing, while different priorities provide redundancy and failover capabilities for high-availability mail systems.