MX Records - How To
Posted by , Last modified by on 25 November 2013 03:12 PM
What are MX Records?
An MX Record, or mail exchanger record, is a DNS entry that designates the server or servers responsible for receiving incoming messages on behalf of a recipient's domain. Properly-configured MX records are essential to ensuring that sending mail servers are able to find and establish SMTP connections to the correct recipient. An MX record consists of mail server hostnames combined with preference numbers. When there are multiple mail servers for a given domain, these preference numbers specify the priority each server is given when a delivery attempt is made; lower preference numbers indicate a higher priority.
MX Records are managed by the domain administrator. For SMTP communication coming from servers external to your network, a public DNS entry must be created. If a domain uses private DNS servers as opposed to relying on public DNS such as OpenDNS or Google's DNS, MX records should be created on the private DNS servers as well.
When a Cipafilter is used for Anti-Spam and email processing, MX records should be configured to point to the Cipafilter's hostname (the name resolving to the Cipafilter's public IP address). This will ensure that all incoming email is first routed through the Cipafilter before being sent to the internal mail server (such as a Microsoft Exchange server or Google Apps/Google Mail.
Verifying Your MX Records
There are various ways to check your existing MX records. In Windows, you can open a command prompt (cmd.exe) and enter the following command:
nslookup -type=MX example_domain.com 22.214.171.124
nslookup is a utility that queries the Domain Name System to obtain DNS record data. The -type=MX argument specifies that we are interested specifically in the MX record for example_domain.com. Finally, 126.96.36.199 is listed specifically to perform the query against Google's public DNS server, which is hosted at 188.8.131.52. If you were using nslookup to view an MX record on an internal DNS server, you would simply substitute 184.108.40.206 with the internal IP address of your DNS server. When querying for internal DNS entries, it will be necessary to use a tool such as nslookup or dig so that you can specify your internal server.
The output of nslookup appears as follows when querying for google.com's MX records:
Google maintains multiple mail servers, which is reflected in this result. Google.com uses mail exchangers named aspmx.l.google.com and alt1-alt4.aspmx.l.google.com. Note that the lowest preference number, 10, is assigned to aspmx.l.google.com, indicating that it has the highest priority. Each alternate server's preference number increases as its priority decreases.
An alternative method for checking your public MX record is to use the tools available at http://mxtoolbox.com/. The MX Toolbox site has a wealth of utilites for troubleshooting email server issues; in addition to checking your MX records and other DNS records, you can check to see if your domain is listed on any of the well-known email blacklists.
MX Toolbox tells you essentially the same thing thing that nslookup does; it provides the host name and associated preference number for each of Google's publically listed mail servers, as well as its IP address and Time to Live (TTL; indicates how long connecting servers should cache the record).
Creating and Publishing MX Records
Publishing public MX records will require access to your domain's DNS settings. The process for publishing DNS entries varies greatly from provider to provider. For instructions specific to your domain, you will need to contact your DNS provider or domain registrar.
If you are using internal DNS for your network, you can also find information about creating MX records specific to your server OS. For example, Microsoft provides information via technet at http://technet.microsoft.com/en-us/library/cc779227(v=ws.10).aspx.
For more information, Google has provided detailed instructions for properly configuring MX records.