Yandex
Update cookies preferences

What is an MX record - how to set it up and test it

MX records - (MX records - mail exchanger) - A resource or configuration record in DNS, for managing and routing email, specifying the mail host names of a domain, without which mail cannot function. The purpose of an MX record is to instruct servers on where to deliver e-mail.

How emails are sent


An email goes through a number of stages on its journey from sender to recipient:

  1. The sender generates an email, the email client (Gmail, etc.) sends this email to your SMTP server using the SMTP protocol (Simple Mail Transfer Protocol). The SMTP server interacts with the email and using the domain (the name after the '@' in the email address), identifies the recipient's address.
  2.  
  3. The next step is a DNS (Domain Name System) lookup. Your SMTP server performs a DNS lookup to find the recipient's mail server - this is similar to searching for subscriber data in the "Internet phone book". Using the MX record of the DNS resource, the domain mail server is determined.
  4.  
  5. Message routing: DNS is used to look up the mx record of the requested domain. When a valid address is obtained, the email is sent to the recipient's mail server.
  6.  
  7. The recipient server is like a post office at the recipient's place of residence. It receives a letter from the sending server, decides whether to deliver it and then sends it to the recipient's mailbox. The recipient's SMTP server is similar to a mail courier, it puts the letter in the mailbox and from there the user picks up the letter using a mail program (Outlook, The Bat!) or web interface. This is where the final filtering of mails takes place.

How to create and configure an MX domain record


Mail Exchange records or mx records are the information without which email delivery to your email is not possible. Just as a mail server is a digital post office, in your neighborhood, collecting, sorting, and delivering your mail to recipients' mailboxes. MX records deliver mail to recipients like mailmen do, with the destination being the recipient's mailbox.  Without MX records, it is impossible for email to function on a domain.

Setting up an mx domain record is required for:

  1. Mail Routing. MX records determine to which mail servers email addressed to a specific domain should be routed and allow you to identify the servers that handle incoming messages for the domain.
  2.  
  3. Mail infrastructure management. MX records allow you to configure as well as manage mail servers and priorities to them to ensure reliable and efficient mail delivery.

When you buy and register a domain name, such as example.com, your domain name provider is the host for your domain name and manages your Domain Name System (DNS) records. These DNS records are responsible for linking your domain name to your website, email services, and other online services.
 
The Domain Name System (DNS) is similar to the phone book. Only instead of names, this "book" contains domains, and phone numbers are the IP addresses of servers and other devices on the Internet.
 
But in order for this "phone book" was current (valid) information and to be available to other devices on the network to the path to it, you need to write resource records DNS for each domain.
 
There are certain types of DNS configuration records that define various characteristics of a domain and the network resources to it. Here are the most common types of DNS records:

  • A Address Record - translates a domain name into an IPv4 address.
  •  
  • AAAA records (IPv6 Address records) - connects a domain name to an IPv6 address. Each "AAAA" record contains IPv6 address information to the domain name.
  •  
  • CNAME records (Canonical Name records) - referred to as "true names" or "canonical names" that map an alias to its true, canonical domain name counterpart.
  •  
  • MX record (Mail exchange record) - Indicates a mail server that accepts emails for a specific domain. MX records identify the host that will be used to process or forward mail via the SMTP protocol for the specified DNS domain. 
  •  
  • TXT record (Text record) - gives information about the domain in txt format (a record of arbitrary binary data). The txt record is used, in particular, to specify SPF records.
  •  
  • SPF record is a txt record that lists all authorized hostnames / IP addresses that are allowed to send email on behalf of your domain and is used to avoid spam.
  •  
  • DMARC record (stands for Domain-based Message Authentication, Reporting & Conformance) - tells the recipient server what to do if the email is not authenticated by DMARC and where to send reports on email authentication statistics, also makes it easier to detect spam or prevent phishing emails from reaching inboxes.
  •  
  • CNAME record (Canonical name) - A canonical name record that allows you to create an alias that points to your domain name and associates the alias with your real or canonical domain name.

Configuring an mx domain record:

You need to go into the DNS management settings for your domain. Any mx domain records contain a hostname indicating where email should be directed, and a priority indicating the order in which mail servers should be used. A lower value indicates a higher priority.

To set up mx recording:

  1. Go to the ISP website where the DNS zone for managing your domain is located.
  2. Enter your login and password to log in to the control panel.
  3. Go to the DNS zone management section of the required domain.
  4. You need to delete all previously configured MX records.
  5. Next, write a new MX record with the following parameters:
  • Subdomain: @ Hostname, the part of the domain in the record parameters to which the MX record applies. 
  • Value: emx.gmail.com
  • Priority: 10 (mx record priority - the lower the number, the higher the priority). The MX record priority is important if there is more than one mail server to the same domain (for example, Google mail has six). It indicates which server is accessed first, second and so on. The logic is simple - the one whose number is smaller is prioritized.
  • Server: the address of the server that will be responsible for email on your domain
    6. After clicking "save": mx record will appear in the resource records of your domain.

Let's look at an example:

There is a mail domain - example.com. And a mail server - mail.example.com.
Therefore, the mx record should look like this: example.com. IN MX 10 mail.example.com
Where:
example.com - the domain of the mail being processed.                                           
IN - class of the record (in this case, Internet).                           
MX - indicates the type of record.                                                                                               
10 - mx record priority.
mail.example.com - hostname of the mail server that handles incoming mail for example.com.

How to check a domain's MX record


Checking mx records is necessary to make sure they are properly configured and implemented. Inaccuracies in these DNS records can cause the site to be unavailable for a long time. Since, even if edits are made, the implementation will only be up for 72 hours.

Online service


To check the mx record, you can use online services that are included in OC Windows, MacOS and Linux and provided to the user together with the PC. The most popular options are the built-in utilities utility - Nslookup, as well as a similar web service Dig, which give you the ability to set different types of queries.

Command line


To open Nslookup:
  • Windows: click Windows + R.                                                              
  • Type "cmd.exe" and click OK. 
  • Open the nslookup utility. nslookup.exe.                                                          
        Then you need to select the Windows+R key combination and type "cmd".
  • Open the command prompt. 
  • Then type "nslookup -type=mx your-domain.com", after that you need to look at the mx record of the domain to make sure that the resulting MX record is configured correctly.
  • For macOS: click "search" in the top right corner. Type "Terminal" in the search box and press Enter.

As a result of the check, you will get certain data:
  • record type;
  • host;
  • class;
  • parameters.

To open dig (Domain Information Groper):
- For Ubuntu Linux operating system:

In the console, run the dig utility with the parameters.

Format: dig [key] [domain] [dns-record]
Where:
- key - additional parameters to the query setup.
- domain is the domain for which the query is being run.
- dns-record is the type of DNS record you want to retrieve (A, MX, NS, etc).

To get MX records for a mail domain: dig example.com MX

You can also use the optional "+short" key. This will shorten the output of minor information and make the output more compact.

What's important to remember about MX recording


MX records are essential to the functioning of email, transporting emails to the correct server by specifying the mail server host.
Properly configuring and validating MX records is important for successful email marketing. It ensures reliable delivery of your emails and reduces the risks of mailing problems.
To summarize, DNS MX records play an important role in maintaining smooth and efficient email routing and delivery. Properly configured MX records ensure that your mail server is running reliably.
02 Aug 2024, 12:02:05

Dedicated Servers, NL

Browse Configurations