Our Blog

Share

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 somedomain.com 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 somedomain.com. An A record is given below:

mail.somedomain.com. IN A  173.248.140.173

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:

somedomain.com. IN MX 10 mail.somedomain.com.

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:

somedomain.com. IN MX 10 173.248.140.173

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:

mail.somedomain.com. IN CNAME mail.anotherdomain.com.
somedomain.com. IN MX 10 mail.somedomain.com.

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.

somedomain.com. IN MX 0 mail.somedomain.com.
somedomain.com. IN MX 10 in.somedomain.com.
somedomain.com. IN MX 20 usa.somedomain.com.
somedomain.com. IN MX 30 uk.somedomain.com.

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 somedomain.com might be:

somedomain.com. IN MX 0 mail.somedomain.com.
somedomain.com. IN MX 10 in.somedomain.com.
somedomain.com. IN MX 10 usa.somedomain.com.
somedomain.com. IN MX 20 uk.somedomain.com.

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

  1. mail.somedomain.com
  2. Either in.somedomain.com or usa.somedomain.com
  3. The remaining 10 preference mail exchanger not used in step 2
  4. uk.somedomain.com

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:

  1. http://mxtoolbox.com
  2. http://www.iptools.com
  3. http://www.intodns.com

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 google.com). It list all MX records for the domain as shown in below figure:

Obtaining MX record using nslookup

Share

Gopal Thorve

0 comments
Read more:
How to Install .Net Framework 3.5 Features on Windows Server 2012 R2?

When you try to install .NET Framework 3.5 Features on Windows Server 2012 R2 you might get below error if...

Close