DNS MX Record
The MX resource record in DNS refers to a mail exchange record.
What's an MX Record?
An MX record will list the name of the email server, or several email servers, that are to be used for the domain.
Purpose of an MX Record
When a user sends an email message, the mail transfer agent (MTA) asks the DNS of that particular recipient domain for the MX records. The MX record will give the host name or names of the mail servers accepting email for that domain. The sending MTA then creates a Simple Mail Transfer Protocol (SMTP) connection with one of the specified hosts.
In the case that there are several mail servers, the MTA will try to establish a connection with the host that has the lowest priority listed. Priority, or preference, is a way which companies may load balance how mail is received by their email servers. If the priority is the same, then email will be evenly balanced between all the servers, as shown in the example above. This also allows for the creation of High Availability (HA) clusters for each domain.
A third party may provide you with a backup email server, in the case that your email servers go down. This may also be created as a backup MX record within your DNS zone. Backup MX records will often just be assigned a lower priority so that they are used sparingly.
According to RFC 5321 an MX record is not required today, however it is a best practice. Often when domains do not have an MX record, mail sent from a domain which has no MX record may be filtered as SPAM by a mail server responsible for accepting email and therefore email delivery will fail.
Create an MX record on domain
This will depend on the DNS management tool being used. In Micetro, an MX record is created by doing the following:
- Click on the DNS tab on the Micetro Web UI
- Double click on the zone for which you’d like to have a new MX record created
- Click the Create button
- Give the MX record a name
- Select MX as the type
- GIve an appropriate TTL
- Specify a Priority value
- Specify a server (or use the default filled in automatically)
- Click Create Now or Add to Request depending on your permissions
Use nslookup to find/view MX records
You can use the nslookup tool in order to find information about MX records with a domain. Just go to the command line and type:
nslookup q=mx exampledomain.com