What is an MX Record?

An MX record or Mail exchange record is a type of resource record in the Domain Name System (DNS) specifying how Internet e-mail should be routed. MX records point to the servers to send an e-mail to, and which ones it should be sent to first, by priority.

When an e-mail message is sent through the Internet, the sending mail transfer agent makes a DNS query requesting the MX record for the recipient's domain name, which is the portion of the e-mail address following the "@". This query returns a list of host names of mail exchange servers accepting incoming mail for that domain, together with a preference number. The sending agent then attempts to establish an SMTP connection to one of these servers, starting with the one with the smallest preference number, delivering the message to the first server with which a connection can be made. If no MX records were present, a second request is made for the A record of the domain instead.

The MX mechanism provides the ability to run multiple mail servers for a single domain and the order in which they should be tried, increasing the likelihood that mail may be delivered and providing the ability to distribute the processing of incoming mail across multiple physical servers.

The MX mechanism does not grant the ability to provide mail service on alternative ports, nor does it provide the ability to distribute mail delivery across a set of equal-priority mail servers by assigning a weighting value to each one.

MX priority

A primary point of confusion is how the priority system works for MX selection. The relative priority of an MX server is determined by the preference number present in the DNS MX record. When a remote client (typically another mail server) does an MX lookup for the domain name, it gets a list of servers and their preference numbers. The MX record with the smallest preference number has the highest priority and is the first server to be tried. The remote client will go down the list of servers until it successfully delivers the message or gets permanently rejected due to an unreachable server or if the mail account does not exist on that server. If there is more than one entry with the same preference number, all of those must be tried before moving on to lower-priority entries.

A favorite technique of spammers is to connect to the lowest priority MXs for a domain (those with the largest numerical value) in an attempt to avoid any anti-spam filters that may be running on the primary (highest priority) MX. Computer viruses have also been known to employ this technique in an effort to avoid anti-viral software.

 This is an example of a typical DNS record (for yourdomain.com), displayed within WHM/cPanel (notice the MX record for the domain yourdomain.bz): 

The MX record shows that all emails @ yourdomain.bz should be routed to the mail server at yourdomain.bz. The DNS record shows that yourdomain.bz is located at 64.38.9.50. This means that email meant for foo@yourdomain.bz will be routed to the email server at 64.38.9.50. This completes the task of the MX record. The email utility on that server (e.g.sendmail) then takes over, collects the email and then proceeds to distribute it to the user ``foo''.  Note that the MX record points to a domain, NOT to an IP address.  The A record identifies the IP address of the domain.

It is important that there be a dot(``.'') after the domain name in the MX record. If the dot is absent, it routes to ``yourdomain.com.yourdomain.com''. The number 0 indicates the priority number. Mail is always routed to the server which has the lowest priority number. If there is only one mail server, it is usually set to 0.

Multiple Mail Servers (Multiple MX Records)

If email is critical to your business, you should consider having multiple email server accounts. This will give you redundancy, so that your email will still function should one or more email account fail. To enable this solution, you simply add MX records for each additional email server that you have, as in the following example.

In the above example, the single MX record is:

yourdomain.bz.  14400  IN  MX 0  yourdomain.bz.

If we have another email server at server2.yourdomain.bz., with the IP address of 64.38.9.55, we would add the following A record:

server2.yourdomain.bz.  14400  IN  A  64.38.9.55

and the following additonal MX Records:

server2.yourdomain.bz.  14400  IN  MX  1  server2.yourdomain.bz.

If the Highest Priority email server (one with the lowest Preference number) is down, then the email is routed to the Server with the second highest Preference number.  If all the MX records are equal Preference numbers, the client simply attempts all equal Preference servers in random order, and then goes to MX record with the next highest Preference number.  You can add as many MX records as you like for additional redundancy, as long as you have the additional server accounts to reference.



Adapted from http://en.wikipedia.org/wiki/MX_record
  • 172 משתמשים שמצאו מאמר זה מועיל
?האם התשובה שקיבלתם הייתה מועילה

מאמרים קשורים

How do I set up my email in Outlook Express?

MediaCatch has made it easy to set up your e-mail on Outlook Express and can be set up by just...

How to set up a default address that receives all unrouted e-mail

With MediaCatch, you can set up so that all unrouted e-mail can be sent to one account. For...

How does e-mail forwarding work?

E-mail forwarding lets you create an e-mail address which will redirect all incoming mail into...

Troubleshooting Outlook Express Error 0x800CCC92

Symptom - you get the following (or similar) error message when trying to retrieve email from a...

Why do I get this error? Protocol: SMTP, Port: 25, Secure(SSL): No, Error Number: 0x800CCC0B

You may receive this error in your email client settings at some point. In Outlook this is a bug...