An MX-record (Mail eXchange-record) is a type of resource record in the Domain Name System (DNS). This is the system that, among other indicates to what specific IP address emails need to be sent.
The MX-record contains the host name of the computer(s) that handle the emails for a domain and a prioritization code. Emails are routed through to the IP address which is set in the A-record of the host.
Unlike many other record types, mail records generally don't map a host to something, because they apply to the entire zone. As such, they usually look like this:
IN MX 10 mail.domain.com.
Note that there is no host name at the beginning.
Also note that there is an extra number in there. This is the preference number that helps computers decide which server to send mail to if there are multiple mail servers defined. Lower numbers have a higher priority.
The MX record should generally point to a host defined by an A or AAAA record, and not one defined by a CNAME.
So, let's say that we have two mail servers. There would have to be records that look something like this:
IN MX 10 mail1.domain.com.
IN MX 50 mail2.domain.com.
mail1 IN A 111.111.111.111
mail2 IN A 222.222.222.222
In this example, the "mail1" host is the preferred email exchange server.
We could also write that like this:
IN MX 10 mail1
IN MX 50 mail2
mail1 IN A 111.111.111.111
mail2 IN A 222.222.222.222
The A-record (or address-record) determines which IP address belongs to a domain name. This record 'translates' the domain name to an IP address.
Example of an A-record:
- Domain: example.com
- Host name: mail
- IP-address: 11.22.33.222
The mail server is now called mail.example.com, this can be used in the MX-record.
Example of an MX-record:
- Domain: example.com
- Mail exchanger: mail.example.com
- Priority: 10
All emails sent to recipient@example.com, willl be sent to the mail server mail.example.com with the IP address 111.222.333.444.
Alert: For Control Panel Help & Tutorials, click here: Panel Tutorials