The DNS MX is a DNS record that has an essential role in the proper functionality of your email server. It points to the right email server or servers for accepting emails for the domain name.
Without it, the sending email servers will not know where is the target of the emails and can’t ensure proper delivery.
What is a DNS MX record?
The DNS MX record, also known as the mail exchanger record, is a key component of a working email server that links a domain name to the hostname of the incoming mail server. It is a name-to-name connection that indicates the host that the senders need to interact with for the communication. The senders will then ask for the IP address, and finally, they can send emails.
A DNS MX record will have the following parameters: type – MX, Host – domain name, Points to – the hostname of the incoming mail server, TTL – time in seconds that indicates for how long the DNS record is valid, Priority – a number that could be between 0 and 65535 and shows which email server should receive the email.
You can have multiple email servers for accepting emails and put them different priority values through different DNS MX records. It is good to provide backup. We recommend you to use a number like 10 or more as a baseline. That way, if you want to put a server with a higher priority, you can set another MX record with 9 or lower number. If you want, you can put a higher number too. You have enough space.
How does the DNS MX record works?
To understand the DNS MX record, let’s see all the necessary steps that one outgoing mail server needs to perform in order to send an email to domain.com.
1. A user on the outgoing email server is trying to send an email to Maria that has the email firstname.lastname@example.org.
2. The outgoing mail server will see the domain name, in this case, domain.com, and query it to get where exactly its nameservers are.
3. What the sender needs is a DNS MX record, so it knows where to send the email. So it queries the nameservers of domain.com (for example, ns1.domain.com, ns2.domain.com, etc.) for MX record.
4. Domain.com responds with one or more MX records that show which servers can receive emails for domain.com (for example, emailone.domain.com, emailtwo.domain.com, etc.).
5. The sender receives the MX records, sees the host or hosts responsible for receiving emails, and makes a new query for A or AAAA records to get the IP address or addresses of the servers.
6. When it gets the IP address, finally, it can send the email to email@example.com.
*This model skips verification or authentications on the way for simplicity.
Now you know a bit more about how does outgoing and incoming mail servers work. The MX record is an essential building block that we need to put right away. It will help us receive the emails in the right place. Otherwise, you might not receive emails for your domain, and that is a serious problem.