what is a DNS MX Record?

A DNS MX record is a type of DNS record that stores the mail exchange server for a domain. It’s used to route emails to the right place. Every domain name that you own has an MX record associated with it. If you have multiple domains, they all have their own MX records. 

MX records contain two pieces of information:

  • The hostname of your mail exchange server 
  • The priority number assigned to each mail exchange server 

Why do you need to configure DNS MX Records?

MX stands for Mail eXchanger, and it’s an essential part of how email works. It’s a record that’s set up by the owner of a domain to tell other servers where they can send emails for that domain. The MX record is usually tied to an A record, which tells you where you can find the server that hosts your domain.

When you set up an MX record, you tell other mail servers which server(s) you want them to use when they try to send emails for your domain. A DNS server will check that record before sending the message, so it knows where to send it if it can’t connect directly.

This is useful because it helps prevent spam from being sent from your domain and allows you to manage how messages are delivered from multiple domains without having to manage each one individually.

MX records for your email vendors

If you’re using a third-party service like Google Apps, or Office 365, it’s likely they’ll provide you with two MX records: one for sending mail and one for receiving mail. The receiving MX should point to their servers, while the sending MX should point to your own server.

If you don’t have any third-party services, you might only need one MX record that points to your own server.

MX Record Examples

Given below is an example of an MX Record 

Domain Name TTL Class Type Priority  Hostname / Value
domain.com 1800 IN MX 10 mail1.domain.com
domain.com 1800 IN MX 20 mail2.domain.com

Note: An MX record cannot point to a CNAME record which is a canonical name record used to setup domain aliases. 

MX Preferences and Priorities

When you send an email, your computer contacts a mail server somewhere and asks it to deliver the message. The mail server has all the information about where to send the message. It looks at the destination address (the To: field) and finds the best server to deliver it.

But if you have more than one mail server for your domain, how does your computer know which one to use?

It uses a priority order. Mail servers that have higher priorities are contacted before those with lower priorities. If there are two servers with equal priority, the one with the lowest numerical value is contacted first.

The priority order is determined by your DNS records (MX records). The lower number is given higher priority. So if you have several mail servers set up with different priorities, they will be contacted in order from lowest number to highest number.

How are MX Records queried in the DNS?

DNS queries are a fundamental part of how the internet works. When you type in a URL in your browser, your computer makes a request for the IP address of that website to the DNS server on your internet service provider (ISP).

MX records are one type of DNS record used to look up where an email server is located. Just like any other type of DNS record, MX records are queried through DNS servers. The difference is that instead of looking up domain names like “google.com” or “nytimes.com,” you’re searching for their associated email server addresses instead.

When an email is sent to a recipient’s email server, the receiving MTA queries the sender’s DNS to verify the mail exchange servers responsible for sending the email. This is done by looking up the information published in the sender’s DNS MX records. 

How to lookup and check your DNS MX Records?

When you are the domain owner, it is recommended that you closely monitor your DNS records to maintain your domain’s health and email performance. To do so, frequent DNS lookups and checks should be an integral part of your work cycle at regular intervals. 

To check your DNS MX records, you can use our MX record lookup tool to perform a free and instant lookup on your MX records to reveal any underlying syntax or configuration error that may exist so that you can start troubleshooting. 

Latest posts by Ahona Rudra (see all)