MX Record in DNS Explained with Example Configurations

We will be discussing about one of the important underlying technology (when I say underlying technology, do not have the impression that this underlying thing is only used for emails. I must say one major component of an important technology that enables email to work the way it is required to )that each one of us uses knowingly or unknowingly while sending and receiving emails. We will be discussing about MX Records in this tutorial.

SMTP(Simple Mail Transfer Protocol) is the protocol that governs all mail servers over the internet. So if you want to send an email to somebody, you need to talk to that person’s SMTP server(Basically your domain’s SMTP server will talk with the receivers SMTP server while sending an email). Below mentioned are typically the steps that happen while sending an EMAIL.

Step1:You compose a message using an Email client of your interest. An email client can be an application installed on your computer like MS Outlook, Mozilla Thunderbird, or a web based email client like, yahoomail etc

An email client is sometimes called as a MUA(Mail User Agent). You will often encounter this term, when discussing about e-mails

  • Your SMTP server and port (This is used for sending email)
  • Your IMAP(Internet Mail Application Protocol)/POP(Post Office Protocol) server and port (with username and password. This is used for receiving emails)

Step2: After you have composed your email with the help of your preferred Email Client, the email client will connect to your SMTP server

Say for example, your SMTP server is Once your email client has connected to SMTP server, it will forward the message you have just composed to the server.

Step 3: Now your SMTP server (To which your email client is connected and forwarded your message), will try to lookup and find the receivers SMTP server. This lookup is done using a DNS query.

What is MX record in DNS?

From the discussion we had above, you might have already got an idea of what MX record actually is. The Domain Name System(DNS) has several types of resource records that full fill the name to ip address translation(Directly or indirectly). The most commonly used resource record are mentioned below. 

  • A Record (Ip address)
  • CNAME  Record(Canonical Name for a name.).
  • NS Record (Used to specify the DNS server responsible for the domain)
  • PTR Record (Used for Reverse Lookup)

MX record in DNS zone file is an optional resource record. Which means, if you do not provide email services for your domain, you can omit this record altogether. Its an optional resource record and not compulsory.

$TTL 1h
@ IN SOA (
1w IN MX 10
ns1 IN A
mail IN A
www IN A

Some Important Things to keep in mind about MX records in DNS

  • The preference number in DNS MX record will only come into picture if you have more than one MX record. Otherwise the single MX record, with any preference number will be preferred
  • The preference number for MX record can have the minimum value of 0 to 65535
  • If your mail host (the FQDN you have added as an MX record) is inside your zone(say for example, you zone is and your mail MX record is Then you must have an A record for your mail host.
  • Your MX record should never point to a CNAME.


View all posts by