1. Home
  2. Knowledge Base
  3. MX Record Essentials

MX Record Essentials

Safeguard Your Email's Journey

When it comes to sending emails, the journey from the sender's inbox to the recipient's inbox can sometimes be a challenging one. Email delivery is dependent on various factors, and one of these factors is a MX record that acts as a guarantor of a successful transmission of an email to its intended destination. It is important for anyone who wants to enhance their mail delivery and ensure that their messages don't get lost in cyberspace.

MX Record Configuration

An MX or Mail Exchange record is a crucial component in the process of email forwarding. In the previous article we shed light on what a DNS (Domain Name System - a storage of information about domains) is and its role in mail delivery and mail security. MX record is a variety of a DNS record which finds an authorized receiving mail sever for the domain specified in the To-field of the header. The information about the receiving email server is specified in the record by the host. In simple words, an MX record acts as a roadmap for emails, telling them where they should go to reach their destination. It serves as a crucial piece of information that helps email servers determine where to deliver incoming messages.

MX records have the following view:

example.net.   3600   IN     MX      20     mailserver1.example.net.
example.net.   3600   IN     MX      30     mailserver2.example.net.

In this example:

  1. Domain Name: The domain name is "example.net."
  2. TTL (Time to live) value: The TTL value is set to 3600 seconds (1 hour). It means that the MX record can be cached by DNS resolvers for up to 1 hour before they need to check for updates.
  3. "IN" stands for Internet.
  4. Record Type: "MX" indicates that it is an MX record.
  5. Preference Value: The preference values are set to 20 and 30. It suggests that the server with the lowest priority value will be tried first.
  6. Mail Exchanger: The mail exchangers are "mailserver1.example.net" and "mailserver2.example.net" which indicate that these mail servers are responsible for handling emails for the domain "example.net."

MX records also use A or AAAA (depending on the IP version) records. An A record contains an IP address of the target domain.

The process of email transmission using mx record check. DNS Sender Mail Server Mail Server Recipient MX Request MX Response Sender Mail Client Mail Client Recipient 187.198.15.95 187.198.15.95 MX records for a domain

Why are MX Records Important?

Configuring MX records in a proper way allows ensuring a smooth routing process and delivery. Here are a few reasons why they are important:

  • Successful delivery: MX records are responsible for determining the route an email takes from the sender to the recipient. Having specified MX records correctly, you can be sure that your email will be directed to the appropriate mail server, increasing the chances of successful delivery.
  • Avoid being marked as spam: Many email providers perform MX record checks on incoming messages to avoid cases when an email might be flagged as spam or rejected. A proper MX record configuration will improve email deliverability and help an email avoid getting caught in spam filters.
  • Reliability and Multiplicity: MX records allow you to bind more than one IP address/mail server to your domain and set them in priority order. This means that in case one of the mail servers turns to be unavailable, the email will automatically be routed to the next server in line. This multiplicity ensures that your email has a higher chance of reaching its intended destination, even if there are temporary issues with a specific mail server.
  • Authentication: MX records also help to verify the source of an incoming message. Together with SPF (Sender Policy Framework) record and DKIM (DomainKeys Identified Mail) it provides a high level of email security by matching the sender's domain with an authorized IP address of the server, thus, ensuring the legitimacy of the message source. Therefore, it serves as one of the methods against spoofing and phishing attempts.

HOW IT WORKS

How to Check MX Records?

The direct purpose of a MX record is to find an appropriate exchange server for the domain by its IP to provide a successful delivery of an email from the sender to the recipient mentioned in the To-field of the message. If you have just set up a new MX record and you need to see how it works or for some other reasons, it is possible to do MX record check. It can be done with the help of various online tools and commands. Here are a few of them:

Using command Prompt/Terminal

  1. Open the command prompt or terminal and enter the command "nslookup -type=MX domainname.com".

    usr@usr-lap:~$ nslookup -type=MX gmail.com
  2. When you replace "domainname.com" with your actual domain name (gmail.com in the example given above), you'll see the MX records associated with your domain.

    Server:         127.0.0.53
    Address:        127.0.0.53#53
    
    Non-authoritative answer:
    gmail.com       mail exchanger = 5 gmail-smtp-in.l.google.com.
    gmail.com       mail exchanger = 30 alt3.gmail-smtp-in.l.google.com.
    gmail.com       mail exchanger = 10 alt1.gmail-smtp-in.l.google.com.
    gmail.com       mail exchanger = 20 alt2.gmail-smtp-in.l.google.com.
    gmail.com       mail exchanger = 40 alt4.gmail-smtp-in.l.google.com.

Online DNS Lookup Tools

You can use our MX Records lookup application

  1. Simply enter the domain name in the search field.
  2. Press the "Lookup MX record" button.
  3. Get a record with the Mail exchange server domain name.

Dig command:

  1. If you have access to a Linux or Mac system, you can use the "dig" command to check MX records: "dig MX domainname.com".

    usr@usr-lap:~$ dig MX gmail.com
  2. When you replace "domainname.com" with your actual domain name (gmail.com in the example given above), you'll see the MX records associated with your domain.

    ; <<>> DiG 9.18.12-0ubuntu0.22.04.1-Ubuntu <<>> MX gmail.com
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50633
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 1
    
    ;; OPT PSEUDOSECTION:
    ; EDNS: version: 0, flags:; udp: 65494
    ;; QUESTION SECTION:
    ;gmail.com.                     IN      MX
    
    ;; ANSWER SECTION:
    gmail.com.              1790    IN      MX      10 alt1.gmail-smtp-in.l.google.com.
    gmail.com.              1790    IN      MX      30 alt3.gmail-smtp-in.l.google.com.
    gmail.com.              1790    IN      MX      40 alt4.gmail-smtp-in.l.google.com.
    gmail.com.              1790    IN      MX      5 gmail-smtp-in.l.google.com.
    gmail.com.              1790    IN      MX      20 alt2.gmail-smtp-in.l.google.com.
    
    ;; Query time: 0 msec
    ;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
    ;; WHEN: Fri May 26 23:00:54 MSK 2023
    ;; MSG SIZE  rcvd: 161
          

Checking MX records is important to ensure that they are correctly configured and pointing to the desired mail servers. If you encounter any issues or discrepancies, you can contact your domain registrar or hosting provider for assistance in resolving the problems.

Common Issues

While MX records are relatively straightforward to set up, there are some common misconfigurations and issues that can affect email delivery. Let's take a look at a few of them:

  • Missing MX Records: The absence of MX records for a domain will result in failed email delivery. It is crucial to have at least one MX record specified to ensure proper routing of incoming emails.
  • Incorrect Priority Values: for multiple MX records priority values are assigned, one value for each record, ranging from 0 to 65535. When choosing between these values, the sending server will prefer the exchange server with the lower value first. The values must be different, otherwise, MX records with the same priority value can lead to delivery issues.
  • Missing or Incorrect A/AAAA Records: MX records are tied to A or AAAA records of the mail servers. If these records are missing or incorrectly configured, email delivery will be affected. It is important to ensure that the A or AAAA records of your mail servers are set up correctly and match the MX records.
  • Port Blocking by Firewall: If your mail server is behind a firewall that restricts incoming connections on the required ports, it can prevent email delivery. Make sure that your firewall settings allow incoming connections on the necessary ports to ensure a seamless delivery process.
  • Outdated MX Records: Over time, the infrastructure of email servers may change. If you are using outdated or stale MX records, emails may be directed to non-existent or decommissioned servers, resulting in delivery failures. Regular review and update of your MX records will guarantee an uninterrupted email delivery.

Frequently asked questions

Find answers to your questions about the MX records

What happens if my MX records are misconfigured?

If your MX records are misconfigured, email delivery can be affected. Emails may bounce back, get marked as spam, or fail to reach their intended recipients.

Can I have multiple MX records for redundancy?

Yes, you can have multiple MX records for redundancy. By specifying multiple mail servers with different priority values, you ensure that emails are delivered even if one server is unavailable.

How long does it take for MX record changes to propagate?

MX record changes usually propagate within a few hours, but it can take up to 48 hours for the changes to fully propagate across the internet. During this time, emails may still be delivered to the old mail servers.

Can I change MX records without affecting email delivery?

Changing MX records can impact email delivery if not done correctly. It is recommended to consult with your domain registrar or hosting provider for assistance in making the necessary changes.

Are MX records related to email security?

MX records play a role in email security through mechanisms like SPF and DKIM. Properly configured MX records contribute to enhanced email security and help prevent spoofing and phishing attempts.

Can I use an IP address instead of a domain in MX records?

No, MX records require the use of domains and cannot be directly specified with an IP address. MX records point to the A or AAAA records of the mail servers, which then map to the IP addresses.