What is a DNS MX record?

The DNS MX ("Mail Exchange") records map hostnames to hostnames of email hosts, along with message routing instructions as an extra input "Priority". Priority determines the preferred email host for a message to be delivered, and preferred fallbacks if one of the email hosts failed to connect. DNS MX records are protocol specific records, limited to SMTP (Simple Mail Transfer Protocol), which handle email routing and delivery.

Input required to set DNS MX records

DNS MX record requires four inputs:

  1. Name: This is the DNS name of a hostname. For example, the DNS name will be "www" for the hostname "www.example.com". To set up a DNS record for the root domain “example.com“, this field can be left empty or the symbol ‘@’ used instead. DNS Name must follow the limits defined in RFC1035,
    i. DNS name can have up to 250 characters, and must start with a letter (a-z), end with a letter or a digit (0-9), and can have only letters, digits, and hyphens (-) as characters.
    ii. DNS name can be split into labels using the dot (.) character, to a maximum of 8 labels. Each label can have 63 characters or less.
  2. Data: For the DNS MX record, data (target) is the hostname of the destination host (SMTP host). This target hostname should be mapped to an email host using DNS A or AAAA record, and not recommended to use CNAME alias records.
  3. Priority: Priority (preference) can range from digits 0 to 100. The MX records with lower priority values have the highest preference in receiving traffic. If two DNS MX records have the same priority values, both email hosts gain equal preference.
  4. TTL: TTL or Time To Live is the time-span limit (in seconds) for the DNS data on the Internet. DNS caching servers use this limit while saving the record temporarily for faster DNS resolution.

Usage scope for DNS MX records

DNS MX records resolve a hostname to another hostname which itself resolves to the IP address of an SMTP email host. This target hostname is not recommended to be mapped to an alias using CNAME records, but an email host IP address using a DNS A or AAAA records to prevent looping, timeouts and message loss.

How to host a DNS MX record

DNS records are hosted on the Internet through DNS hosting services. If you are using Slickalpha DNS, check this related guide to learn how to add a DNS record on your Slickalpha account.

How to check DNS MX records

DNS records can be queried directly on your system terminal using the dig command. To check your DNS MX records on the browser, try our free DNS Lookup tool.

Uses of DNS MX records

DNS MX records play an important role in message routing, helping mailers and email delivery agents to determine the authoritative destination for the email messages.

Managed DNS