What is DNS MX Record and How to Check It?

Have you ever wondered how your organization’s domain receives emails from business partners and prospective clients? While it seems like your email provider handles the process, there’s more to it than that.

To avoid DNS Spoofing, it’s a good idea to understand the various types of DNS records, including the DNS PTR record, txt record, NS record, and SOA record in DNS, among others.

Today, we’re discussing the DNS MX record.

To correctly receive emails in your domain, the email server should know where to deliver them. This is where the DNS MX record comes in. This article will explore an MX DNS record and how you can check it.

What is a DNS MX Record, and What’s its purpose?

What is an MX record in DNS? It’s one of the types of DNS records that route emails to nameservers using the Simple Mail Transfer Protocol (SMTP). It’s otherwise called a Mail Exchange record. If you want to resolve mail servers to know where your domain mailbox resides, you must configure your MX records correctly. 

Put simply, a DNS MX record tells everyone which mail servers accept mail for your domain. It also indicates where mail sent to your domain should route to. If your MX DNS records aren’t correctly configured or pointing to the right location, you may be able to send emails, but you won’t receive any.

Similar to a CNAME record, an MX record must alway point to a domain, hostname, or address records like an A or AAAA record to function correctly (and not an IP address). Below is an MX format example. 

myserver.com Record type: priority: value: TTL
@ MX 10 mailhost1.myserver.com 45000
@ MX 20 mailhost2.myserver.com 45000

The priority number indicates the order of preference: The lower priority number record is the most preferred. In the above MX record, the nameservers first try the domain name with the lowest priority number, being 10. 

But if it fails, the server resolves back to the second domain. You can configure both MX records with the same priority number, so they receive the same number of emails.

How to Query an MX Record?

Querying your MX record is known as MX DNS record lookup, and the process is straightforward. This determines the internal and external nameservers attached to a particular domain. 

When a user sends a message to your domain, the Mail/Message Transfer Agent (MTA) sends a query to all known servers to identify the MX record. If the MX record is available, it creates an SMTP connection with those mail servers, starting with the prioritized domain.

What’s a Backup MX Record?

This MX record handles your emails if the primary mail server is unreachable. The backup MX record has a higher priority number (lower preference). In the MX format shown above, the mailhost2.myserver.com is the backup MX record. Under normal conditions, the mailhost1.myserver.com handles all incoming emails as long as it’s active.

Who Controls the MX Record?

The company that hosts your DNS nameservers controls your MX records. So you can manage your MX record via their control panel.

How to Check an MX Record?

You can check your MX record online or locally on your device. However, checking MX records locally or online comes with upsides and downsides. 

Using an Online MX Tool

The simplest way to check your DNS MX record is by using an online MX tool. Enter the MX record in the tool’s search option and hit the “Search” button to run the MX DNS lookup process. 

Using Chrome Extension

With the Google Chrome DNS lookup extension, you can quickly check the MX record of your website without having to leave the page. 

Checking MX Record on Windows

You can look up MX records on your Windows Operating System using the nslookup command. Additionally, the command also lets you specify the DNS server you like. Below is how to use nslookup on your windows devices.

nslookup

> set q=mx

> myserver.com

If you want to use a specific DNS resolver, the command looks like the following:

nslookup

> set q=mx

> server 10.121.191.1

> myserver.com

Checking MX Record on Mac and Linux

Linux and Mac OS users can also perform DNS check MX records lookups. These include MacOS or MacOS X and famous Linux systems like Debian, Ubuntu, Red Hat, and CentOS. In this case, you can use the dig or host tool to look up your MX record locally. Like the Windows OS, you can specify the DNS server you like. 

You can use the host tool locally with the below command:

host -t mx myserver.com.

If you want to use a specific DNS resolver, the command becomes:

host -t mx myserver.com 10.121.191.1.

You can use the dig tool locally with the below command:

dig mx myserver.com.

If you want to use a specific DNS resolver, the command becomes:

dig mx myserver.com @10.121.191.1

Can an MX Record Point to a CNAME?

The canonical name or CNAME DNS record points to the domain’s alias instead of the original name. According to RFC 2181, pointing an MX record to a CNAME record is forbidden. Typically, the CNAME record points to the domain’s A record (in IPv4) or AAAA record (in IPv6). 

On the other hand, an MX record should point directly to the server’s A record (hostname) or AAAA record (hostname). No address will be returned when your MX record points to a CNAME record.

Summary

This article has discussed everything you need to know about MX records and how to check MX records for a domain. Once you understand the fundamentals, configuring your MX record in the DNS server becomes easy. 

The best practice is implementing two mail servers to ensure you always receive your email. You can give the mail servers different priority numbers or the same preference according to your domain need. Remember to point your MX record to the server’s A or AAAA record, not the CNAME record.

Weekly Email Security News Recap #2 [August 2022]

Weekly Email Security News Recap #2 [August 2022]

It takes as less as $25 to create customized hacking tools for compromising systems....

Read More
DDoS vs. DoS Attacks: What’s the Difference?

DDoS vs. DoS Attacks: What’s the Difference?

The internet has made life easier and more convenient. But just like everything, it...

Read More
What is a Cybersecurity Audit and  Why is it Important?

What is a Cybersecurity Audit and  Why is it Important?

If you run a data-driven business, you’ll need a cyber security audit at some...

Read More