What is a DNS MX record?
A DNS ‘mail exchange’ (MX) record directs email to a mail server. The MX record indicates how email messages should be routed following the Simple Mail Transfer Protocol (SMTP, the standard protocol for all email). Like CNAME records, an MX record must always point to another domain.
Example of an MX record:
example.com | record type: | priority: | value: | TTL |
---|---|---|---|---|
@ | MX | 10 | mailhost1.example.com | 45000 |
@ | MX | 20 | mailhost2.example.com | 45000 |
The ‘priority’ numbers before the domains for these MX records indicate preference; the lower ‘priority’ value is preferred. The server will always try mailhost1 first because 10 is lower than 20. As a result of a message send failure, the server will default to mailhost2.
The email service could also configure this MX record so that both servers have equal priority and receive an equal amount of mail:
example.com | record type: | priority: | value: | TTL |
---|---|---|---|---|
@ | MX | 10 | mailhost1.example.com | 45000 |
@ | MX | 10 | mailhost2.example.com | 45000 |
This configuration enables the email provider to balance the load between the two servers equally.
What is the process of querying an MX record?
Message transfer agent (MTA) software is responsible for querying MX records. When a user sends an email, the MTA sends a DNS query to identify the mail servers for the email recipients. The MTA establishes an SMTP connection with those mail servers, starting with the prioritized domains (in the first example above, mailhost1).
What is a backup MX record?
A backup MX record is just an MX record for a mail server with a higher ‘priority’ value (which means a lower priority) so that mail will go to the more prioritized servers under normal circumstances. In the first example above, mailhost2 would be the ‘backup’ server because email traffic will be handled by mailhost1 as long as it is up and running.