What is a Mail Exchanger (MX) Record?

Unlike a postal address, which contains several pieces of information (name, house/apt. number, street, city, state, ZIP code) about where postal mail should be delivered, an email address only provides two pieces of data: the mailbox ID and the domain name.

These are neatly separated by the @ sign with the mailbox ID to the left and the domain name to the right. If your address is username@OnlyMyEmail.com then your mailbox ID is username and the domain name is OnlyMyEmail.com.

Fortunately, given how email works, this is enough to ensure accurate delivery.

Delivering Email

From the perspective of the Internet at large, the domain name is really all that matters. It’s up to the server that handles email for a given domain to determine which mailbox should receive the message. All the sending server needs to know in order to deliver a message is the recipient domain.

Since the right-hand side of an email address is the domain name, this is easy enough to figure out. Unfortunately, computers don’t really understand domain names the way people do. What computers understand is IP addresses.

Enter DNS

This little fly in the ointment is due to the fact that IP addresses like work great for computers but all those digits don’t make sense to us humans. To us, OnlyMyEmail.com is much easier to remember than So the trick is to have people use domain names and computers use IP addresses.

The Domain Name System (DNS) bridges the gap between human readable domain names and computer friendly IP addresses by mapping domain names to IP addresses. Every domain has a set of DNS records that connect its name to the IP addresses of the servers that supply services for the domain. These records are stored on the Name Server for the domain and made available to the world so that the domain can be located.

So What About MX Records?

MX records are a specific type of DNS record used to locate the mail exchanger (M as in Mail and X as in eXchanger) for the domain specified in the domain name side of the email address. The mail exchanger is any computer configured to accept delivery of email for that domain.

When email is delivered, the destination server is determined by looking up the MX records for the domain and sending the email to the targets specified in therein.

A typical set of MX records will look like this:

onlymyemail.com.        300     IN      MX      10 mailfilter1.onlymyemail.com.

onlymyemail.com.        300     IN      MX      20 mailfilter2.onlymyemail.com.

onlymyemail.com.        300     IN      MX      30 mailfilter3.onlymyemail.com.

onlymyemail.com.        300     IN      MX      40 mailfilter4.onlymyemail.com.

Each line is a single MX record and each domain can have several. This allows the owner of the domain to specify more than one server that will accept delivery.  Multiple servers may be desirable in situations where several servers share the load for one domain, as backup servers or both.

MX records consist of the following (from left to right):

  • Domain Name – This is the name of the domain to which the record belongs. The trailing dot (.) at the end of the domain name is required.
  • Time To Live (TTL) – In order to avoid constantly looking things up, the results of DNS lookups are usually saved (cached) by the machine doing the looking. TTL is the number of seconds that can pass before the record has to be looked up again.
  • Class – Allows DNS records to be used for networks other than the Internet. Since this is rare, class is pretty much always IN for Internet.
  • Type – For MX records type will always be MX . That’s why they’re MX records (as opposed to A or NS records).
  • Priority/Preference – This establishes the order in which servers should be contacted when there are multiple MX records with multiple servers.
  • Target – The hostname of the computer where mail should be delivered. This also requires the trailing dot (.) to work correctly.

Editing MX Records

DNS records are generally maintained by the hosting provider for a domain or, for domains that handle their own DNS, by the IT staff of the domain owner.

Note: When DNS records are not maintained in-house they must be accessed using the interface provided by the hosting service. This may allow the editing of individual fields in the records, line by line editing of record sets or a facility to upload files containing DNS records. Since DNS editing interfaces are all slightly different, a click-by-click how-to would occupy several volumes. For the sake of brevity just keep in mind that each line in a set of MX records for a domain represents a way to deliver mail to that domain.

The usual reason for editing MX records is to change where email is delivered for a domain. This is often done to have email sent to a company owned email server or an email service provider (like us).

Sometimes MX records have to be edited to re-establish these services after changing web hosting as web hosting providers will often reset the MX records of newly hosted domains to point to their own mail exchangers.

Of the six fields in an MX record only three make sense to change. Changing the domain name makes the record for a different domain; the type must remain MX or the record ceases to be an MX record and the class is always IN.

This leaves TTL, priority and target available to change.

Time To Live (TTL)

TTL is frequently 86400 which is 60 X 60 X 24 seconds or the number of seconds in a day. This means that the longest it can take for cached copies of your MX records to update is 24 hours. This is normally quite effective since MX records don’t change very often.

However, it can be useful to update the TTLs on MX records in advance of a change in order to make them propagate faster during the change. Lowering the TTL to 300 (5 minutes) a day before making the actual MX changes will cause cached records to be updated in 5 minutes instead of 24 hours and make mistakes reveal themselves much sooner. Once the changes are proven correct, TTLs should be set back to 864000 to keep the hosting server from being deluged by DNS cache update requests.


Both priority and preference are likely terms for this field. Either way the field should contain a decimal integer (a.k.a. a number). Records with lower numbers are tried first, thus a record with a priority of 10 would be tried before a record with a priority of 20.

It is generally recommended to number in increments of 10 or so to allow new records to be inserted between older ones without having to renumber all of the subsequent records. For instance, if your preference settings are 0, 1, 2,  3 and you want to add a new highest priority server you have to raise all of the other priorities by 1. Whereas, if your preferences are 10, 20, 30, 40 you could stick in a new highest priority server by setting it’s priority to 5 without touching any of the other records.


The target is the most critical of the editable fields in an MX record. TTL and priority/preference can be off by a little (as long as they’re numbers) without interrupting mail delivery. Target on the other hand has to be perfect or it won’t work.

First, the target must be a Fully Qualified Domain Name (FQDN). In this context the the outstanding feature of the FQDN is that it includes the trailing dot.  If the trailing dot is omitted the hostname won’t work. (Some interfaces will catch this and fix it but don’t count on it.)

Spelling is also important. Computers don’t gloss over spelling errors the way humans do. It only takes one incorrect character to cause mail delivery to fail, or worse, deliver mail to the wrong domain.

Finally, it is important to note that some interfaces will allow the use of an IP address instead of a domain name. While this may actually work, it is contrary to the DNS specification (see IETF RFCs 974, 1034 and 1035) and may cause email from your domain to be rejected by mail servers that are strict about RFC compliance. This can be extremely difficult to troubleshoot because it only causes intermittent failures. It is much better to avoid this problem altogether by using FQDNs instead of IPs in MX records.

Verifying MX Records

Most hosting providers will tell you what they think your MX records are but it can be worthwhile to get a second opinion. Finding and using a good MX lookup tool (or several) will often help with troubleshooting by revealing discrepancies between what you think is in your MX records and what is actually returned by a routine MX lookup request for your domain.

More Information

Wikipedia – MX Records

- -

OnlyMyEmail is an award winning hosted spam filtering service and business email hosting provider. Our enterprise cloud computing anti-spam solution, the MX-Defender, has the highest capture rate of any spam filter ever tested in the VBSpam Challenge, blocking a record setting 99.9993% of all malicious and junk email.

Our Personal spam filtering system is also a Software as a Service (SaaS) solution and has won both the PC World "World Class Award" and also the PC Magazine "Editor's Choice Award."

OME-Kids is a webmail solution that protects children from spam and other harmful emails. OME-Kids offers unique Parental Controls that allow you to choose the level of security and oversight that's right for your child.

Tags: ,

Comments are closed.