MX Record

What is MX Record?

MX Record – A mail exchanger record. This is a type of resource record that specifies a mail server responsible for accepting messages on behalf of a recipient’s domain. This is required to be able to use an email with your domain email address.

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 setups, as below:

Domain                 TTL   Class    Type Priority      Host

example.com.          1936   IN      MX      10         onemail.example.com

example.com.          1936   IN      MX      10         twomail.example.com

The characteristic payload information of an MX record is a preference value (above labeled “Priority”), and the fully qualified domain name of a mail server (“Host” above).

The priority field identifies which mail server should be preferred – in this case, the values are both 10, so mail would be expected to flow evenly to both onemail.example.com and twomail.example.com – a common configuration. The hostname must map directly to one or more address records (A, or AAAA) in the DNS, and must not point to any CNAME records.

Advertisements

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 hostnames 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.

MX preference

According to RFC 5321, the lowest-numbered records are the most preferred. This phrasing can be confusing, and so the preference number is sometimes referred to as the distance: smaller distances are more preferable. An older RFC, RFC 974, indicates that when the preference numbers are the same for two servers, they have the same priority, hence those two terms are used interchangeably.

The basics

In the simplest case, a domain may have just one mail server. For example, if an MTA looks up the MX records for example.com, and the DNS server replied with only mail.example.com with a preference number of 50, then the MTA will attempt delivery of the mail to the server listed. In this case, the number 50 could have been any integer permitted by the SMTP specification.

When more than one server is returned for an MX query, the server with the smallest preference number must be tried first. If there is more than one MX record with the same preference number, all of those must be tried before moving on to lower-priority entries. An SMTP client must be able to try (and retry) each of the relevant addresses in the list in order until a delivery attempt succeeds.

Load distribution

The standard approach to distributing a load of incoming mail over an array of servers is to return the same reference number for each server in the set. When determining which server of equal preference to send mail to, “the sender-SMTP MUST randomize them to spread the load across multiple mail exchangers for a specific organization”, unless there is a clear reason to favor one.

An alternative approach is to use multihomed servers, where the one host returns several IP addresses.  This method places the burden on the DNS system rather than the SMTP-sender to perform the load balancing, which in this case will present a list of IP addresses in a specific order to the clients querying the A record of the mail exchanger. Since the RFC requires that the SMTP-sender use the order given in the A record query, the DNS server is free to carefully manipulate its balancing based on any method, including round robin DNS, mail server load, or some undisclosed priority scheme.

Conclusion

Is your company in need of help? MV3 Marketing Agency has numerous Marketing experts ready to assist you. Contact MV3 Marketing to jump-start your business.

« Back to Glossary Index