A DNS MX record is a type of DNS record that stores the mail exchange server for a domain. It is used to redirect emails to the right place.
Every domain name 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 server
- Priority number assigned to each mail exchange server
Why do I need to configure DNS MX Records?
MX stands for Mail eXchanger and is an important part of the email experience. This is a record that a domain owner sets up to tell other servers where they can send emails for that domain. An MX record is usually associated with an A record, which indicates where the server hosting your domain can be found.
When you set up an MX record, you tell other mail servers which server(s) you want them to use when trying to send email for your domain. The DNS server checks this entry 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 your domain and allows you to manage the delivery of messages from multiple domains without having to manage each one individually.
MX records for your email providers
If you use third-party services such as Google Apps or Office 365, they will most likely provide you with two MX records: one for sending mail and one for receiving. The receiving MX must point to their servers, while the sending MX must point to your own server.
If you don't have third-party services, you may only need one MX record pointing to your own server.
MX preferences and priorities
When you send an email, your computer contacts the mail server 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 to.
But if you have multiple mail servers for your domain, how does your computer know which one to use?
It uses the order of precedence. Mail servers with a higher priority access servers with a lower priority. If there are two servers with the same priority, the server with the lowest numerical value is bound first.
The order of precedence is determined by your DNS records (MX records). The lower number has the higher priority. Thus, if you have multiple mail servers configured with different priorities, they will be contacted in order from lowest number to highest.
How are MX records queried in DNS?
DNS queries are a fundamental part of how the Internet works. When you enter a URL in a browser, your computer makes a request for this website's IP address to your Internet Service Provider's (ISP) DNS server.
MX records are one type of DNS record used to look up the location of an email server. Like any other type of DNS records, MX records are queried through DNS servers. The difference is that instead of looking up domain names like "google.com", you're looking for their associated mail server addresses.
When an email is sent to the recipient's mail server, the receiving MTA queries the sender's DNS to check the mail exchange servers responsible for sending the email. This is done by looking up information published in the sender's DNS MX records.
How to look up and verify your DNS MX records?
If you are a domain owner, it's a good idea to keep a close eye on your DNS records to keep your domain healthy and your email up and running. This requires frequent DNS lookups and checks should be an integral part of your work cycle at regular intervals.