What is an MX Record?

Posted by

Home » DNS Server » What is an 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 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. Select MX in record type and click lookup.

web based

It will bring the MX records for you.

web based output
  • Install DNS Server

    Install DNS Server

    Before we install DNS server, its essential to understand what exactly a DNS service is? A Windows DNS server is…

  • Authoritative vs Non Authoritative DNS

    Authoritative vs Non Authoritative DNS

    Authoritative vs Non Authoritative DNS debate looks like a little complicated. However we will try to make it easy for…

Leave a Reply

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