What Is an MX Record? How To Find and Set up DNS MX Records
An MX record, or mail exchange record, is a DNS record that routes emails to specified mail servers. MX records essentially point to the IP addresses of a mail server’s domain.
MX records are especially useful for users who host or lease an email because it differentiates web and email servers. In DNS, your A records for your website (examplesite.com) point to your web server, and your MX records point to your mail server. When someone sends emails to email@example.com, the MX record directs to a specified mail server, like Gmail or wherever your email server is hosted.
MX records can specify and prioritize multiple email servers, which is necessary for load balancing and avoiding outages. And MX records are an important part of troubleshooting mail delivery problems for any organization.
How Do MX Records Work?
Here’s how MX records work when someone sends you an emaill:
Their email client forwards the message to an email server
The sending message transfer agent (MTA) sends a DNS query to identify the MX record
The MX record identifies the mail exchange server for the destination’s domain
The sending MTA establishes an SMTP connection with the destination mail server
The email is delivered
An MX record can include multiple email servers. This is important for two reasons:
You can create redundancy. If one mail server experiences an outage, the MX record points to other mail servers, ensuring mail continues to deliver.
You can load balance email traffic across multiple servers.
MX records look similar to other DNS records: they include a domain name, type, TTL, value, and a priority if selected.
How Do I Find My MX Record?
You can use an MX record lookup tool. Simply enter your domain name and you’ll see associated MX records, IP addresses, TTLs, and other relevant info.
These tools can also check that DNS and DMARC records are published, test SMTP, and check for potential blocklists. They are an important part of diagnose email deliverability problems.
Do I Need an MX Record?
MX records are essentially a standard part of email delivery. They’re technically not required for a sender domain, but due to spam, receiving servers may reject emails from a domain without an MX record. In short, if you want to successfully deliver emails, you need an MX record.
MX records are also necessary for the following:
Receiving emails through a separate domain from your web server
Load balancing mail flow across multiple servers
How Do I Set Up and Configure an MX Record?
Specifics depend on your email and web domain hosts.
Email providers have built-in MX records for end users, so you don’t need to set anything up. But if you want to direct email from your web domain host to a separate email provider, you’ll need to change your MX record. This generally involves the following steps:
Login to your domain hosting account.
Remove existing MX entries from your domain’s DNS management page.
Add new MX records associated with a preferred mail server. These are designated by your mail server.
For a more detailed description, see these MX record configuration instructions from Google Workspace.
When setting up MX records, you can select a TTL, which often defaults to 3600 unless otherwise specified. You can also include multiple servers and assign server priorities.
MX Record Priority
To load balance and avoid outages, users can add multiple servers to an MX record and select a priority order. Mail is sent to the MX record with the lowest priority, or evenly across multiple servers if they have the same priority.
When selecting priority numbers, lower numbers have higher priority. Here’s an example:
Mail server 1: Priority 10
Mail server 2: Priority 20
Mail server 3: Priority 30
In this scenario, emails use the lowest priority server, or mail server 1. If mail server 1 is overwhelmed or experiences an outage, the email is routed through mail server 2.