A DNS MX (Mail Exchanger) Record is a DNS record type used to specify the address of the mail server. MX records tell the email system which server it should pass the message to when it is sent.
When you send an email, the mail client looks for the MX record of the target email address. The MX record contains a priority value and the domain name of a mail server. A priority value indicates the priority order of the mail server. A lower value indicates a higher priority. The mail client will attempt to connect to the mail servers in the MX record, in order of priority, until the message is successfully sent or all servers are tried.
For example, if you send an E-mail to example.com, the mail client looks up the MX record of example.com to find the domain name and priority of one or more mail servers. The mail client will then attempt to connect to these mail servers in order of priority until the message is successfully sent.
The setting of MX records is usually configured by the domain's administrator or mail service provider. By setting MX records correctly, you can ensure that emails are correctly routed to the target mail server, enabling reliable email delivery.
Here is a table with an example MX record:
As you can see, the DNS MX record consists of the following parts:
We commonly use the nslookup tool to query DNS records. Nslookup is a command-line network administration tool used for querying the Domain Name System (DNS) to obtain domain name or IP address mapping information. It can be used to look up various types of DNS records, such as A (address) records, MX (mail exchange) records, and NS (name server) records. Nslookup is available on most operating systems, including Windows, macOS, and Linux. It is commonly used for troubleshooting DNS issues and verifying DNS configurations.
To lookup DNS MX records using nslookup, follow these steps:
1. Open a command prompt (Windows) or terminal (Mac and Linux).
2. Enter the following command format:
nslookup -type=mx example.com
3. Replace "example.com" with the domain name you are looking for.
4. Press Enter to execute the command.
Nslookup displays the result of the MX record. You will see one or more MX records, each containing the priority value and the domain name of the mail server.
For example, here is sample output from looking at an MX record for example.com using nslookup:
Server: UnKnown
Address: 192.168.1.1
Non-authoritative answer:
example.com MX preference = 10, mail exchanger = mail.example.com
In this example, the MX record shows a priority value of 10 and a mail server domain name of mail.example.com.
To set up an MX record, you need to visit the control panel or administrative interface of your domain registrar or DNS hosting service provider. The exact steps may vary from service provider to service provider, but the following general process is usually followed:
1. Log into the control panel or administrative interface of your domain registrar or DNS hosting service provider. You may need to provide your account credentials.
2. Look for DNS administration or domain Settings options. This can usually be found in domain name management, DNS Settings, DNS administration, or similar sections.
3. In the MX Records section, you may see a list of existing MX records (if you already have MX records set). If there are no existing MX records, you will see a blank MX record table or a button to add MX records.
4. When adding MX records, you need to provide the following information:
5. After entering the full MX record information, save or apply the changes.
6. Wait for DNS records to propagate. Typically, changes to DNS records take some time to take effect globally, a process known as DNS propagation. In general, this process can take anywhere from a few minutes to a few hours.
Please note that the exact setup process may vary by service provider. If you are having difficulty or are unsure how to set up MX records, refer to your service provider's documentation or contact their support team for assistance.
To set up load balancing for DNS MX records, you can use the following methods:
For example:
example.com. IN MX 10 mail1.example.com.
example.com. IN MX 20 mail2.example.com.
example.com. IN MX 30 mail3.example.com.
In this example, there are three MX records, one for three different mail servers. Priority values of 10, 20, and 30 indicate that mail1.example.com has the highest priority, and mail3.example.com has the lowest priority.
For example:
example.com. IN MX 10 mail1.example.com.
example.com. IN MX 10 mail2.example.com.
example.com. IN MX 10 mail3.example.com.
In this example, the three MX records have the same priority value of 10, and the mail client will randomly select one of the mail servers to send the mail.
DNS MX records play several key roles in the email system:
In summary, DNS MX records play a critical role in the email system, ensuring that messages are correctly routed and delivered to the target mail server, and providing flexible control and configuration options to meet different needs and scenarios.
If your platform needs to quickly and securely distribute content to customers worldwide, we invite you to use Tencent EdgeOne .
Tencent EdgeOne can provide integrated analysis, acceleration and security services for your site. With an extensive network of edge servers worldwide, Tencent EdgeOne ensures low latency and high-speed content delivery, no matter where they are located. The platform integrates advanced security features such as DDoS protection, SSL encryption, and access control to keep your content safe.
We have a free trial available now, please contact us for more information.