About mail exchanger (MX) records

An MX record is an entry in the DNS zone file that identifies the mail server responsible for handling email messages for that domain name.

Each MX record comprises the following:

  1. A preference number. This is a value from 0 to 65,535 that denotes the mail server's priority within the domain.

  2. The host name of the mail server. This is the name of the server responsible for handling email for a domain.

When the mail server processes an email message, it first looks for the MX record of the destination address. When the Exchange server processes the email message, it either delivers the email message to the recipient or forwards the email to its destination server, using Simple Mail Transfer Protocol (SMTP). The SMTP server checks for the MX record of the domain in the email address. The server then gets details of the mail exchange server for the domain and connects to the mail server.

A domain can have more than one MX record. This ensures that even if the primary mail server is down, the email messages are temporarily sent to another mail server. Multiple MX records are specified for the same domain, with each MX record given a different preference value. The lower the preference value, the higher the priority.

Thus, when a mail server needs to send email to a domain, it first contacts a DNS server for that domain and retrieves all the MX records for that domain. It then contacts the mail server with the highest priority (lowest preference value). If the MX record with the highest priority cannot be reached, the SMTP server exhausts the list of available MX records from the highest priority to the lowest priority.