What is MX Record?

Posted by

Home » DNS Server » What is MX Record?

In DNS a MX record is like an address book for email servers. It tells other servers where to send emails for a specific domain name. Every domain has its own MX record created on its authoritative DNS server that tells other email servers where to deliver their email.

What is MX record

A MX record contains two important pieces of information.

  1. The name of the server that should can be used to deliver the email for that domain.
  2. Priority number that tells servers which server to use first.

It’s must to set up MX records because they help ensure that emails are delivered to the right place. When you set up an MX record, you tell other mail servers which server(s) you want them to use when they try to send emails for your domain.

In this example we are using nslookup to find out the email servers of Gmail. Following is the sequence of commands on command prompt,

  1. nslookup
  2. set type=mx
  3. gmail.com

As a result of these commands followings are the MX records are found for gmail.com.

Mx Record

Based upon the above outcome, the sending email server will try to connect the SMTP with following order. Since the preference is 5,10,20,30,40.

  1. gmail-smtp-in.l.google.com (Preference 5)
  2. alt1.gmail-smtp-in.l.google.com (Preference 10)
  3. alt2.gmail-smtp-in.l.google.com (Preference 20)
  4. alt3.gmail-smtp-in.l.google.com (Preference 30)
  5. alt4.gmail-smtp-in.l.google.com (Preference 40)

Why multiple MX Record

Now the questions arises why we need multiple records. Answer is simple, if first email server is down and unable to receive the email, the sending server will retry to send email to 2nd or third server and so on. Incase non of the servers is available for email delivery, the sending server will keep the email in it queue and retry after some time. If none is reachable for a long period of time, sending server may discard the email (depending of sending email server policy) and generate a non delivery alert for the sender.

Another and relatively easier way to run for mail server loookup of Gmail in single line is “nslookup -q=mx gmail.com”. Following is the output.

mx record in one command

If you want to make your life more easy. Web based GUI tools are also available to query MX record of domain. Go to “http://pingstage.com“. Type the domain name in this example we are using gmail.com. Select MX in record type and click lookup.

It will bring the MX records of gmail.com for you. Later these names can be converted to IP address using DNS A record.

If you want to learn more What is DNS server and different type of DNS records, and you may check other articles/posts on our site.

Frequently Asked Questions (FAQ)

How to find MX record for a domain?

You can run “nslookup -q=mx domainname.com” to find the MX record for any domain.

Can we have more than one MX record?

Yes it is possible to have more MX records for a domain. Infect it is recommended to have more than one mail exchanger records for redundancy and failover purpose.

What if no MX record is found for a domain?

This will result into non delivery report (NDR).

Can you hide MX record?

No you can not. The whole purpose of MX record is to tell others which email server should be used to deliver email. Incase of trying to hide the whole purpose is lost.

  • DNS Propagation

    DNS Propagation

    DNS propagation. How it works. What you need to know. Key factors. How to plan it effectively. Myths and much more.

  • What is private DNS Server?

    What is private DNS Server?

    Private an public DNS server. Understand the use of private DNS. Its benefits. Use case and much more.

Leave a Reply

Your email address will not be published. Required fields are marked *