MX Record

When you send an email to the recipient, have you ever wondered how your email server knows where the recipient domain’s email services are hosted and where to deliver mail sent by you. It is DNS MX record which instructs the sending email server where to deliver an email addressed to the domain account. The DNS MX record points to the host server responsible for processing or forwarding emails addressed to the domain. Here, processing is the term used for either delivering email to the mailbox to whom it is addressed or gatewaying it to the another email transport. Forwarding means sending an email to the final destination or to another mail exchanger closer to the destination via SMTP say something like Firewall.

Creating an MX record

Assume that, we want to create an MX record for domain then first of all we need to create an A record pointing to the IP address of the host responsible for processing or forwarding email addressed for An A record is given below: IN A

After creating A record, we can create an MX record pointing to the FQDN of the A record we recently created above. An MX record will look like below: IN MX 10

Please note that one should never create an MX record directly pointing to the IP address of the host email server. Never create an MX record as shown below: IN MX 10

Also never point the MX record to canonical name (cname) record, because they don’t check for aliases (domain names on the left hand side of CNAME record). So, never do as shown below: IN CNAME IN MX 10

To prevent the mail routing loops, the MX record has an extra parameter called preference value just beside the FQDN of the host. It is an unsigned 16-bit ranging between 0 and 65535, which indicates mail exchangers priority when multiple MX record exists for the domain and instructs the sending email server to which mail exchanger it should try to send email to. The lower the preference value the higher the mail exchangers priority. IN MX 0 IN MX 10 IN MX 20 IN MX 30

In above scenario, the sending mail server should first attempt delivery mail exchanger with the lowest preference value first and if it fails it should move on to next higher preference value mail exchanger.

For example, the MX record for might be: IN MX 0 IN MX 10 IN MX 10 IN MX 20

These MX records instruct sending email servers to attempt delivery to in following order:

  2. Either or
  3. The remaining 10 preference mail exchanger not used in step 2

How to obtain MX records for a domain?

There are many websites available on internet using which you could obtain the list of MX records for a given domain name. Some websites are listed below:


You can also obtain MX records for a domain from your Windows machine using below procedure:

  1. Launch Command Prompt (Start – Run – cmd – OK)
  2. Type ‘nslookup’
  3. Type ‘set q=mx’ and press Enter
  4. Type domain name for which you want to obtain MX records for (say It list all MX records for the domain as shown in below figure:

Obtaining MX record using nslookup

Related Posts

Leave a Reply