Sign In
Deliverability

How to Setup MX Record in Easy Steps

How to Setup MX Records: A Comprehensive Guide for Email Delivery

Setting up MX records correctly is crucial for ensuring your emails reach their intended recipients. Incorrect or missing MX records can lead to bounced emails, missed communications, and ultimately, a negative impact on your business. This guide will provide a detailed walkthrough on how to properly configure MX records, ensuring optimal email delivery and reliability. We’ll cover everything from understanding MX record syntax to best practices for ensuring your emails land in the inbox, not the spam folder.

Table of Contents:

Understanding MX Records: The Foundation of Email Routing

MX records, short for Mail Exchanger records, are a critical component of the Domain Name System (DNS). They specify the mail servers responsible for accepting email messages on behalf of your domain. When someone sends an email to your domain (e.g., someone@yourdomain.com), the sender’s mail server queries the DNS records for yourdomain.com, specifically looking for the MX records. These records then tell the sending server where to deliver the email.

Without properly configured MX records, emails sent to your domain will simply bounce back to the sender, as their mail server won’t know where to deliver the messages. This can lead to significant communication issues, especially for businesses that rely on email for customer communication, marketing, and internal operations.

An MX record consists of two primary components:

  • Priority: A numerical value indicating the preference for a particular mail server. Lower numbers indicate higher priority (i.e., the mail server that should be tried first).
  • Hostname: The fully qualified domain name (FQDN) of the mail server responsible for accepting email for your domain.

Here are some practical examples to illustrate how MX records work:

Example 1: Basic MX Record Setup

Let’s say you’re using Google Workspace (formerly G Suite) for your email. Google will provide you with a set of MX records that you need to add to your domain’s DNS settings. A typical Google Workspace MX record might look like this:

Priority: 1
Hostname: ASPMX.L.GOOGLE.COM

This record tells sending mail servers to first try delivering email to the mail server with the hostname ASPMX.L.GOOGLE.COM. The priority of 1 indicates it’s the most preferred server.

Example 2: Multiple MX Records for Redundancy

For improved reliability, it’s common to have multiple MX records with different priorities. This ensures that if the primary mail server is unavailable, the sending server can try a backup server.

Priority: 1
Hostname: ASPMX.L.GOOGLE.COM

Priority: 5
Hostname: ALT1.ASPMX.L.GOOGLE.COM

Priority: 5
Hostname: ALT2.ASPMX.L.GOOGLE.COM

Priority: 10
Hostname: ALT3.ASPMX.L.GOOGLE.COM

Priority: 10
Hostname: ALT4.ASPMX.L.GOOGLE.COM

In this example, if ASPMX.L.GOOGLE.COM is unavailable, the sending server will try ALT1.ASPMX.L.GOOGLE.COM or ALT2.ASPMX.L.GOOGLE.COM (since they have the same priority). If those are also unavailable, it will then try ALT3.ASPMX.L.GOOGLE.COM or ALT4.ASPMX.L.GOOGLE.COM.

Example 3: Incorrect MX Record Configuration

An example of an incorrect MX record setup might be having no MX records at all, or having MX records that point to an invalid or non-existent mail server.

Priority: 10
Hostname: invalid.mail.server.example.com

If the hostname `invalid.mail.server.example.com` doesn’t resolve to a valid mail server, or if no server is listening for SMTP connections at that address, emails will bounce.

Expert Tip: Always use the hostname provided by your email service provider (e.g., Google Workspace, Microsoft 365, Zoho Mail). Do not use your own domain name as the hostname for the MX record unless you are running your own mail server. This is a common mistake that leads to email delivery issues.

Understanding the role and structure of MX records is the first step towards ensuring reliable email delivery for your domain. In the next section, we’ll explore how to locate your DNS settings, where you’ll actually add and configure these records.

Locating Your DNS Settings: Where the Magic Happens

Before you can add or modify MX records, you need to find where your domain’s DNS settings are managed. This is typically done through your domain registrar or your hosting provider, depending on where you purchased your domain name and where your website is hosted. Sometimes, these are the same company, but often they are separate.

Here’s a breakdown of common scenarios and how to locate your DNS settings in each:

  • Domain Registrar: If you only registered your domain name (e.g., with GoDaddy, Namecheap, Google Domains) but don’t have hosting with them, your DNS settings are likely managed through their platform.
  • Web Hosting Provider: If you have a web hosting account (e.g., with Bluehost, SiteGround, HostGator), your DNS settings are often managed through your hosting control panel (e.g., cPanel, Plesk).
  • Third-Party DNS Provider: Some companies use dedicated DNS providers like Cloudflare, Amazon Route 53, or Google Cloud DNS for more advanced DNS management capabilities. In this case, you’ll need to log into your account with the DNS provider to manage your records.

Here are some specific examples to guide you:

Example 1: Locating DNS Settings in GoDaddy

1. Log in to your GoDaddy account.

2. Go to your “My Products” page.

3. Find your domain name and click the “DNS” button next to it.

This will take you to the DNS Management page where you can view and edit your DNS records, including MX records.

Example 2: Locating DNS Settings in cPanel

cPanel is a popular control panel used by many web hosting providers.

1. Log in to your cPanel account (usually through your hosting provider’s website).

2. Look for the “Zone Editor” or “DNS Zone Editor” icon (it might be in the “Domains” or “Email” section).

3. Select the domain you want to manage from the list.

This will allow you to add, edit, or delete DNS records, including MX records.

Example 3: Locating DNS Settings in Cloudflare

Cloudflare is a popular service that provides CDN, DNS, and security services.

1. Log in to your Cloudflare account.

2. Select the website you want to manage.

3. Click on the “DNS” icon in the top navigation bar.

This will display your DNS records, including MX records, which you can then modify.

Practical Example: Let’s say your domain is `example.com` and you want to use Google Workspace. After signing up for Google Workspace, Google will provide you with specific MX records. You need to log into *where* your domain’s DNS is managed. If you bought `example.com` at Namecheap and are using Namecheap’s BasicDNS, then you log into Namecheap. If you transferred the DNS to Cloudflare, you log into Cloudflare. The key is knowing where the authoritative DNS records are for your domain.

Once you’ve located your DNS settings, you’re ready to add or modify MX records. The specific steps for adding and configuring MX records will vary depending on the DNS management interface you’re using, but the general principles remain the same. We’ll cover those steps in detail in the next section.

Adding and Configuring MX Records: A Step-by-Step Guide

Now that you’ve located your DNS settings, let’s walk through the process of adding and configuring MX records. While the interface may vary slightly depending on your DNS provider, the fundamental steps are generally the same. We’ll use a generic example, but remember to adapt it to your specific provider’s interface.

Here’s a step-by-step guide:

  • Access your DNS management interface: Log in to your domain registrar, hosting provider, or third-party DNS provider and navigate to the DNS settings for your domain.
  • Locate the DNS records section: Look for a section labeled “DNS Records,” “Zone Editor,” or similar. This is where you’ll find all the DNS records for your domain.
  • Add a new MX record: Find the option to add a new record. This is often a button labeled “Add Record,” “Create Record,” or a plus (+) icon.
  • Select the record type: Choose “MX” from the record type dropdown menu.
  • Enter the MX record details: You’ll need to provide the following information:
    • Hostname/Name: This is usually your domain name (e.g., yourdomain.com). Some interfaces may automatically populate this or require you to enter “@” to represent the root domain.
    • Priority/Preference: Enter the priority value provided by your email service provider. Remember, lower numbers indicate higher priority.
    • Value/Destination/Mail Server: Enter the fully qualified domain name (FQDN) of the mail server, as provided by your email service provider (e.g., ASPMX.L.GOOGLE.COM).
    • TTL (Time To Live): This specifies how long DNS servers should cache the record. The default TTL is usually sufficient (e.g., 3600 seconds or 1 hour).
  • Save the record: Once you’ve entered all the information, save the record.
  • Repeat for all MX records: If your email service provider has given you multiple MX records, repeat steps 3-6 for each record.

Let’s illustrate this with a few examples:

Example 1: Adding Google Workspace MX Records in cPanel

Assuming you’re using cPanel and want to add Google Workspace MX records, you would follow these steps:

1. Log into your cPanel account.

2. Navigate to the “Zone Editor” or “DNS Zone Editor.”

3. Select your domain name.

4. Click the “+ Add Record” button.

5. Add the following records, one at a time:

HostnameTypeRecordPriorityTTL
yourdomain.comMXASPMX.L.GOOGLE.COM13600
yourdomain.comMXALT1.ASPMX.L.GOOGLE.COM53600
yourdomain.comMXALT2.ASPMX.L.GOOGLE.COM53600
yourdomain.comMXALT3.ASPMX.L.GOOGLE.COM103600
yourdomain.comMXALT4.ASPMX.L.GOOGLE.COM103600

Replace `yourdomain.com` with your actual domain name.

6. Save each record after entering the information.

Example 2: Adding Zoho Mail MX Records in Cloudflare

If you’re using Zoho Mail and managing your DNS with Cloudflare:

1. Log in to your Cloudflare account.

2. Select your website.

3. Go to the “DNS” section.

4. Click the “+ Add record” button.

5. Add the following Zoho Mail MX records:

TypeNameContentPriorityTTL
MX@mx.zoho.com10Auto
MX@mx2.zoho.com20Auto

6. Set the TTL to “Auto” (or the default value if “Auto” isn’t an option).

7. Save each record.

Example 3: Adding Microsoft 365 MX Records in GoDaddy

Using Microsoft 365 and managing DNS in GoDaddy:

1. Log in to your GoDaddy account.

2. Go to your “My Products” page and select “DNS” next to your domain.

3. Click “Add” under the DNS records section.

4. Select “MX” as the type.

5. Add the following Microsoft 365 MX record:

HostPoints toPriorityTTL
@yourdomain-com.mail.protection.outlook.com01 Hour

Replace `yourdomain-com` with your actual domain name (but keep the `-com` suffix). There might be other MX records also supplied by Microsoft 365. You should add ALL the MX records, or mail might fail.

Important Considerations:

  • Remove existing MX records: Before adding new MX records, remove any existing MX records that are no longer valid. This is especially important if you’re switching email providers. Having conflicting MX records can cause email delivery problems.
  • Double-check your entries: Carefully verify that you’ve entered all the information correctly, paying close attention to the hostname and priority. Even a small typo can prevent emails from being delivered.
  • Wait for DNS propagation: After adding or modifying MX records, it can take some time for the changes to propagate across the internet. This is the time it takes for DNS servers around the world to update their records. Propagation can take anywhere from a few minutes to 48 hours, although it’s usually much faster than that.

Once you’ve added and configured your MX records, it’s essential to verify that they’re working correctly. In the next section, we’ll explore how to verify your MX records and troubleshoot any potential issues.

Verifying and Troubleshooting MX Records: Ensuring Proper Configuration

After setting up your MX records, it’s crucial to verify that they’re configured correctly. This ensures that email servers can properly route email to your domain. Fortunately, there are several online tools and command-line utilities you can use to check your MX records.

Here’s how to verify your MX records:

  • Online MX Lookup Tools: Numerous websites offer free MX record lookup services. Some popular options include:
  • Command-Line Tools: If you’re comfortable using the command line, you can use tools like `dig` (on Linux and macOS) or `nslookup` (available on most operating systems) to query your MX records.

Let’s look at some examples of how to use these tools:

Example 1: Using MXToolbox

1. Go to MXToolbox.

2. Enter your domain name (e.g., yourdomain.com) in the text box.

3. Select “MX Lookup” from the dropdown menu and click the “MX Lookup” button.

MXToolbox will then display a list of MX records for your domain, including the priority and hostname. Verify that the records match the information provided by your email service provider.

Expected Output:

yourdomain.com    1   ASPMX.L.GOOGLE.COM
yourdomain.com    5   ALT1.ASPMX.L.GOOGLE.COM
yourdomain.com    5   ALT2.ASPMX.L.GOOGLE.COM
yourdomain.com    10  ALT3.ASPMX.L.GOOGLE.COM
yourdomain.com    10  ALT4.ASPMX.L.GOOGLE.COM

Example 2: Using the `dig` command (Linux/macOS)

Open your terminal and run the following command:

dig yourdomain.com MX

Replace `yourdomain.com` with your actual domain name.

The output will include the MX records for your domain, similar to this:

; <<>> DiG 9.16.1-Ubuntu <<>> yourdomain.com MX
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48606
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;yourdomain.com.			IN	MX

;; ANSWER SECTION:
yourdomain.com.		300	IN	MX	1 ASPMX.L.GOOGLE.COM.
yourdomain.com.		300	IN	MX	5 ALT1.ASPMX.L.GOOGLE.COM.
yourdomain.com.		300	IN	MX	5 ALT2.ASPMX.L.GOOGLE.COM.
yourdomain.com.		300	IN	MX	10 ALT3.ASPMX.L.GOOGLE.COM.
yourdomain.com.		300	IN	MX	10 ALT4.ASPMX.L.GOOGLE.COM.

;; Query time: 3 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Tue Oct 27 10:30:30 PDT 2023
;; MSG SIZE  rcvd: 203

The “ANSWER SECTION” shows the MX records, including their priority and hostname.

Example 3: Using the `nslookup` command (Windows)

Open the Command Prompt and type:

nslookup -type=mx yourdomain.com

Replace `yourdomain.com` with your actual domain name.

The output will display the MX records for your domain:

yourdomain.com  MX preference = 1, mail exchanger = ASPMX.L.GOOGLE.COM
yourdomain.com  MX preference = 5, mail exchanger = ALT1.ASPMX.L.GOOGLE.COM
yourdomain.com  MX preference = 5, mail exchanger = ALT2.ASPMX.L.GOOGLE.COM
yourdomain.com  MX preference = 10, mail exchanger = ALT3.ASPMX.L.GOOGLE.COM
yourdomain.com  MX preference = 10, mail exchanger = ALT4.ASPMX.L.GOOGLE.COM

Troubleshooting Common MX Record Issues:

  • Incorrect MX Records: If the MX records displayed by the lookup tools don’t match the records provided by your email service provider, double-check your DNS settings and correct any errors.
  • DNS Propagation Issues: If you’ve recently added or modified your MX records, it may take some time for the changes to propagate. Wait a few hours and try again. You can also try flushing your local DNS cache.
  • Conflicting MX Records: Make sure you don’t have any conflicting MX records that point to different mail servers. Remove any outdated or incorrect MX records.
  • Missing “A” Record for Mail Server: The hostname specified in your MX record (e.g., `ASPMX.L.GOOGLE.COM`) must have a corresponding “A” record that resolves to a valid IP address. While this is usually handled by the mail provider, it’s worth checking if you’re running your own mail server.

Practical Example: Let’s say you use MXToolbox to check your MX records and see this output:

yourdomain.com    10   mail.yourdomain.com

This is a red flag! Unless you’re running your own mail server, your MX records should *not* point to a hostname within your own domain. This likely means you’ve incorrectly configured the MX records and should correct them to point to your email provider’s mail servers (e.g., Google Workspace, Microsoft 365, Zoho Mail).

Expert Tip: After making changes to your MX records, it’s a good idea to send a test email to your domain from an external email address (e.g., a Gmail or Yahoo account) to verify that the email is delivered successfully. Check your spam folder as well, just in case.

By verifying and troubleshooting your MX records, you can ensure that your email is delivered reliably and avoid potential communication issues. In the final section, we’ll discuss best practices for email delivery beyond just setting up MX records.

Best Practices for Email Delivery: Beyond MX Records

While properly configured MX records are the foundation of email delivery, they are just one piece of the puzzle. Ensuring your emails actually reach the inbox and avoid the spam folder requires implementing several other best practices. These practices help establish your sender reputation and prove to receiving mail servers that your emails are legitimate and not spam.

Here are some key best practices to improve your email delivery:

  • Implement SPF (Sender Policy Framework): SPF is a DNS record that specifies which mail servers are authorized to send email on behalf of your domain. This helps prevent spammers from forging your email address.
  • Implement DKIM (DomainKeys Identified Mail): DKIM adds a digital signature to your outgoing emails, allowing receiving mail servers to verify that the email was actually sent from your domain and hasn’t been tampered with.
  • Implement DMARC (Domain-based Message Authentication, Reporting & Conformance): DMARC builds upon SPF and DKIM by providing instructions to receiving mail servers on how to handle emails that fail SPF and DKIM checks. It also allows you to receive reports about email activity using your domain, helping you identify and address potential spoofing or phishing attempts.
  • Maintain a Good Sender Reputation: Your sender reputation is a measure of how trustworthy your email sending practices are. Factors that influence your sender reputation include:
    • Email Volume: Sending large volumes of email suddenly can negatively impact your reputation.
    • Bounce Rate: A high bounce rate (emails that are returned as undeliverable) can indicate that you’re sending to invalid or outdated email addresses.
    • Spam Complaints: If recipients mark your emails as spam, it will damage your sender reputation.
    • Blacklisting: Getting blacklisted by email service providers or anti-spam organizations can severely impact your email delivery.
  • Use a Dedicated IP Address: If you send a large volume of email, consider using a dedicated IP address. This allows you to build your own sender reputation, rather than sharing it with other senders who may have poor sending practices.
  • Warm Up Your IP Address: If you’re using a new IP address, gradually increase your sending volume over time to establish a good sender reputation. This is known as “warming up” your IP address.
  • Clean Your Email List Regularly: Remove invalid, inactive, or unsubscribed email addresses from your list to reduce your bounce rate and improve your sender reputation.
  • Provide an Easy Way to Unsubscribe: Make it easy for recipients to unsubscribe from your emails. This will reduce the likelihood of them marking your emails as spam.
  • Use Double Opt-In: Require subscribers to confirm their email address before adding them to your mailing list. This helps ensure that you’re only sending to valid and interested recipients.
  • Monitor Your Email Delivery: Use tools to monitor your email delivery rates, bounce rates, and spam complaints. This will help you identify and address any potential issues.
  • Content Quality Matters: Avoid using spam trigger words, excessive exclamation points, or misleading subject lines in your emails. Focus on providing valuable and relevant content to your subscribers.

Let’s illustrate how some of these practices apply in real-world scenarios:

Example 1: Implementing SPF, DKIM, and DMARC

To implement SPF, DKIM, and DMARC, you need to add specific DNS records to your domain.

SPF Record:

v=spf1 include:your-email-service-provider.com -all

Replace `your-email-service-provider.com` with the appropriate domain for your email provider. For example, if you’re using Google Workspace, it would be `include:_spf.google.com`. The `-all` at the end tells receiving servers to reject any emails that don’t come from the specified mail servers.

DKIM Record:

The DKIM record is more complex and is usually generated by your email service provider. It will typically look something like this:

v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyC3l8r... (rest of the public key) ...IDAQAB; s=selector

Replace `selector` with the DKIM selector provided by your email provider. You will need to consult your provider’s documentation for instructions on generating and adding the DKIM record.

DMARC Record:

v=DMARC1; p=none; rua=mailto:dmarc-reports@yourdomain.com; ruf=mailto:dmarc-forensic                    

Share this article