MX Record – These days most organizations own a domain and have a presence on the web. An integral part of a business’s online presence is communication. While there are many ways of communicating online, email is still one of the most used methods. And like anything else in DNS, domain-based emails need a record. This record is the Mail Exchange (MX) record, and in this resource, you’ll learn all about it.
Table of Contents
MX Records Explained
The main purpose of an MX record is to instruct servers on where to deliver emails. This is done via the Simple Mail Transfer Protocol (SMTP). It’s an MX record that provides nameservers with the location of your domain “mailbox.” For this record type to function correctly, it must point to an A or AAAA record.
Why are MX records needed?
MX records play a vital role in ensuring the smooth delivery of emails by providing a reliable and efficient mechanism for routing messages. Email providers also play a crucial role in efficiently delivering emails, but with properly configured MX records, directing emails to the correct email provider’s mail server is possible.
MX records provide a more advanced email routing solution than the basic HOSTS.TXT file-based system, allowing for load distribution across multiple mail servers. This approach enhances efficiency by evenly distributing the load and offering alternative options when needed.
Example of an MX record
MX records consist of two parts: the priority and the domain name. For example:
0 mail.EXAMPLE.com
- The ‘0’ is the priority.
- The lower the number means a higher priority.
- The ‘mail.EXAMPLE.com’ is the mail server to which it connects. This is different depending on what company is hosting your email.
- Outgoing email servers connect to the MX servers in order of priority.
- If you use more than one MX record and both have the same priority, it picks one at random. (This in effect load balances the connections.)
What Are the Components of an MX Record?
Here is a table with an example of an MX record:
| Domain Name | Mail Server | Record type | Priority | TTL |
| @ (example.com) | mail1.example.com | MX | 10 | 3600 seconds |
| @ (example.com) | mail2.example.com | 20 | 3600 seconds |
Let’s take a deeper look at the various components of an MX record shown in this table.
In order to have a thorough understanding of the MX record, let’s examine each of its elements and functions in detail.
- Domain name. The domain name refers to the specific domain for which the MX record is configured, such as “example.com” or “example.org.” The “@” symbol is also commonly used in DNS records to represent the root domain name or zone origin, not only for MX records but for various other DNS record types. For example, if the domain is “example.com,” an MX record with the “@” symbol in the name field signifies that it applies to “example.com” directly. The left column (above) shows how this looks.
- Mail server. The mail server indicates the specific host name responsible for handling incoming emails for the domain. For instance, if the domain name is example.com, the mail server could be “mail.example.com” or “smtp.example.com.” The configuration may involve multiple mail servers, all based on the specific settings laid out by the email provider. These multiple servers work together to ensure seamless handling and delivery of emails, regardless of volume or traffic.
- Record type. The record type for MX records is always set to “MX” to identify them as Mail Exchanger records. The MX record type indicates that the record is used for routing emails.
- Priority. The priority field assigns a numerical value to each MX record, indicating the order in which email servers should be contacted. Lower values indicate higher priority, and servers with lower preference values are tried first. Certain email providers, such as Google, set one of their MX records to 0 to guarantee that their mail server is given top priority in the email routing process.
- TTL (time-to-live.) The TTL field represents the time duration in seconds for which the MX record should be cached by DNS resolvers. After the specified TTL expires, resolvers will refresh the record by querying the authoritative DNS servers again. In the chart above, the TTL of 3600 means the MX record will be cached for one hour.
How Does Email Communication Work?
Let’s take a closer look at how an email gets from the sender to the recipient with the help of an MX record.

Here’s a step-by-step breakdown of how email communication works, emphasizing the important role played by MX records.
- Sender composes and sends email. The sender creates an email and specifies the recipient’s email address.
- DNS lookup and MX record retrieval. The sender’s mail server performs a DNS lookup query, consulting the DNS server associated with the recipient’s domain. It retrieves the MX records, which identify the mail servers responsible for handling incoming emails, and determines the MX record’s components, such as associated IP addresses, priority values, and TTL.
- Sender mail server. The sender’s mail server establishes an SMTP connection with the selected mail server using the obtained IP address. An SMTP connection is a communication between two mail servers that facilitates the transfer of email messages.
- Email transfer. The sender’s mail server transfers the email to the recipient’s mail server over the SMTP connection. The sending mail server sends the email to the receiving mail server using a series of commands, including EHLO (Extended HELO,) MAIL FROM, RCPT TO, DATA, and QUIT. These commands ensure proper handshaking, message routing, and data transfer between the servers.
- Receiver mail server. The recipient’s mail server receives the email and conducts various checks, including spam filtering and authentication. After these checks, the email is delivered to the recipient’s mailbox.
In many cases, sending emails doesn’t require you to understand this process, or interact with it directly. However, there might be times when you need to set up a third-party email server, such as Microsoft or Google, or resolve issues with emails not being sent or received from a company server. It’s important for you to verify the proper setup by viewing the MX records. In the next section, we will explore how you can easily check the MX record of a domain name using a command prompt in a Windows OS.