A mail exchanger record (MX record) specifies the mail server responsible for accepting email messages on behalf of a domain name. It is a resource record in the Domain Name System (DNS). It is possible to configure several MX records, typically pointing to an array of mail servers for load balancing and redundancy.
Overview
Resource records are the basic information element of the Domain Name System (DNS). An MX record is one of these, and a domain may have one or more of these setup, as below:
Domain TTL Class Type Priority Host example.com. 1936 IN MX 10 blackmail.example.com example.com. 1936 IN MX 10 whitemail.example.com
The characteristic payload information of an MX record is a preference value (above labelled “Priority”), and the fully qualified domain name of a mailserver (“Host” above).
The priority field identifies which mailserver should be preferred – in this case the values are both 10, so mail would be expected to flow evenly to both blackmail.example.com and whitemail.example.com – a common configuration. The host name must map directly to one or more address record (A, or AAAA) in the DNS, and must not point to any CNAME records.
When an e-mail message is sent through the Internet, the sending mail transfer agent (MTA) queries the Domain Name System for the MX records of each recipient’s domain name. This query returns a list of host names of mail exchange servers accepting incoming mail for that domain and their preferences. The sending agent then attempts to establish an SMTP connection, trying the host with the lowest “Priority” value first. The system allows high-availability clusters of mail gateways to be built for one domain if necessary.
The MX mechanism does not grant the ability to provide mail service on alternative port numbers, nor does it provide the ability to distribute mail delivery across a set of unequal-priority mail servers by assigning a weighting value to each one.