Definition
💡 A mail exchange (MX) record is a DNS record that routes emails to specific mail servers. They ensure smooth email delivery by providing an efficient routing mechanism for messages. Without MX records, your emails cannot reach the correct mail server and, consequently, the recipient’s inbox.
What type of information is contained in a DNX MX record?
A DNS MX record contains the following types of information:
- The mail server’s domain name. This refers to the hostname that accepts incoming emails for specific domains.
- The mail server’s priority or preference value. The lower the priority value, the more it’s preferred by servers. In the example below, the server will try “mailhost1.example.com” first because its priority value is set to 10, compared to mailhost2, which has a priority value of 20. You can configure your email service so that both servers have equal priority value.
- The mail server’s IP address. This is the address your sending server must connect to for it to deliver your email.
Below is an example of what an MX record could look like:
example.com | record type: | priority: | value: | TTL |
---|---|---|---|---|
@ | MX | 10 | mailhost1.example.com | 45000 |
@ | MX | 20 | mailhost2.example.com | 45000 |
Source: https://www.cloudflare.com/learning/dns/dns-records/dns-mx-record/
What is the functionality of an MX record on a DNS server?
Here’s how MX records work:
- When someone sends you an email, the sender’s email client forwards their message to an email server.
- The sender’s Message Transfer Agent (MTA) starts a DNS query to identify the recipient’s mail servers. The MTA does this by checking MX records.
- The DNS query will be directed to the recipient’s DNS server. The latter will respond with the appropriate MX record.
- The sender’s MTA will then establish a Simple Mail Transfer Protocol (SMTP) with the recipient’s mail servers.
- Once this is done, the sender’s email will be delivered.
An MX record has several key functions:
- It specifies the mail servers that will handle incoming emails for specific domains.
- It enables the prioritization of multiple mail servers.
- It helps mail servers tackle redundancy and achieve load balancing.
How do you find and check an MX record?
There are several ways to find and check your MX record:
- Use an online MX lookup tool like DNS Checker, NSLookup, or MxToolbox.
- Use command line tools on Windows, Mac, or Linux.
- Via a Chrome extension (DNS Lookup extension).
When checking your MX record, see that it points to an A or AAAA record (the hostname). Your MX record shouldn’t point to a canonical name (CNAME) because it’s forbidden, according to RFC 2181. If you’re planning to change your MX records, remember that this will also change the location of the mail server.