The MX Record Explained
What Is an MX Record
Did you have to set your domain MX record at some point when creating a business email address but didn’t understand it well?
In this post we’ll explain what an MX record is and how to set it up.
The MX record is a type of DNS record. Don’t know what’s a DNS record is? We cover that fully in our post DNS Records Explained, but in two words: it’s a domain name setting.
Specifically, the MX record is the DNS record specifying which mail service your domain name is using for its emails. MX stands for Mail eXchange.
We’ll break done what that means exactly. Let’s say you own the domain name holymoly.com, and you create a business email address bob@holymoly.com on some domain email service, like postale.io.
During of after registration, you’re asked to set the MX record of holymoly.com to some value provided by the mail service and designating its mail servers. In the case of postale.io for instance, that’s mail.postale.io.
.
You do so, then you add bob@holymoly.com to your favorite mail app, and you’re now ready to send and receive emails with it.
Why was the MX record setup step required, and how does it play when sending and receiving emails?
How MX Records Work
Let’s see how and when MX records are involved in the email system.
Sending an Email
You start by sending an email to alice.stronghold@gmail.com. When you hit the send button in your mail app, it doesn’t send your email directly to the Alice’s mail app.
Instead, your app contacts your sending mail server, which will send your email to Alice’s mail server, which in turn will deliver it to Alice’s mailbox.
Mail apps are in fact mail clients: interfaces to interact with mail servers, which are the ones doing the real work.
The sending mail server is often called the “outgoing” or “SMTP” server. When you added your email address to your mail app, either you had to fill that server information manually according to your mail service’s documentation, or it was filled in automatically for you.
That SMTP mail server is ran by your chosen mail service, the one on which you created your business email address. It has to be, because your address exists only on the servers of your mail service.
If you tried using the SMTP server of another mail service, your sending attempts would be rejected with an error stating no account with your address could be found there.
A bit of vocabulary
SMTP stands for Simple Mail Transfer Protocol. It’s the language in which sending mail servers speak. SMTP servers are also called “Mail Transfer Agents” (MTA), whereas mail clients are called “Mail User Agents” (MUA).
Now the critical part is this: how does your SMTP server knows what’s the SMTP server of Alice, you recipient? The answer is: thanks to Alice’s MX record!
Your SMTP server sends your email to the SMTP server pointed to by the MX record of your recipient domain.
In our example, the recipient address is alice.stronghold@gmail.com, so the target domain is gmail.com. Your SMTP server looks up the MX record for gmail.com and sends your email to whatever SMTP server that points to.
The email is received by the recipient SMTP server, and delivered to the recipient mailbox (Alice’s mailbox in our example).
So you see here the importance of MX records. They are nothing less than what directs emails to their correct destination.
Receiving an Email
Some time later you get a reply from Alice. How did that work?
Well, it’s the exact same process in reverse. Alice’s mail app reached out to Alice’s SMTP server, which sent her reply to the server pointed to by your domain MX record, since you are now the recipient.
Your address being bob@holymoly.com, Alice’s SMTP server sent the email to the server pointed to by the MX record of holymoly.com.
The email thus arrived at your SMTP server, which of course recognized the recipient address (bob@holymoly.com) as an address it manages, and delivered the reply to your mailbox.
What would have happened if your MX record hadn’t pointed to the correct mail server?
Well, the sender’s mail server (Alice’s SMTP server in this example) would have contacted whatever mail server your MX record pointed to, and that server would not have found bob@holymoly.com since you never created the address on its corresponding mail service. That server doesn’t manage any email address named bob@holymoly.com.
The email would have not been delivered and the sender (Alice) would have shortly received an error message indicating no recipient bob@holymoly.com could be found.
If your MX record had been empty, Alice would have received a similar error message indicating no recipient mail server could be found for holymoly.com.
This is why having an MX record pointing to your mail service is absolutely essential. Without it, your domain email addresses simply cannot receive emails.
Ok, there’s something I didn’t mention in order to simplify the discussion. It doesn’t really have to do with the MX record, but it’s an important part of the email delivery system, so let’s cover it briefly.
Remember we said that SMTP servers, when they receive an email from another SMTP server, deliver it to the recipient mailbox. That does not mean they deliver it to the recipient mail app.
It means they deliver the email to the mailbox on a server. Mail apps will download the new email (and notify an email has been received) on their next refresh.
Specifically, mail apps pull emails not from the SMTP server, but from another mail server: a POP or IMAP server. The one responsible for your domain address was also filled in when you added your address to your mail app, either manually by you or automatically.
POP/IMAP servers manage the mailbox, whereas SMTP servers manage sending and receiving between email addresses.
When the SMTP server delivers the email to you mailbox, it actually asks a POP or IMAP server to deliver it to you mailbox.
POP vs IMAP
POP (Post Office Protocol) servers delete emails from the server once they have been downloaded by a mail app.
IMAP (Internet Message Access Protocol) servers keep emails on the server until instructed to deleted them by a mail app. IMAP is more commonly used, as with it you can access the same mailbox from multiple mail apps on various devices (phone, work computer, home tablet, …).
POP and IMAP servers are also called “Mail Delivery Agents” (MUA).
How to Set Your MX Record
You can set your domain MX record by logging in to your domain provider website and accessing the DNS editor for your domain.
If you’re not sure where to find it, this list of DNS guides from common domain providers may be useful.
Here’s what it looks like with postale.io as domain email service and Namecheap as domain provider:
At postale.io we want to make things as easy as possible. That’s why when you create a business email address with us we provide you with a simple DNS configuration guide from which you can copy/paste DNS records to your domain DNS editor.
If you’re a postale.io user and you’re experiencing difficulties with your MX setup, you can also reach out to us, we’ll be happy to help.
How To Check Your MX Record
There are many free tools out there to check what your MX record looks like. A few we can mention are whatsmydns.com, mxtoolbox.com, and dnschecker.org.
Or, if your familiar with the command line, the dig
command works great:
peter@home:~$ dig MX myshinynewdomain.com
; <<>> DiG 9.16.1-Ubuntu <<>> MX myshinynewdomain.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2748
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;myshinynewdomain.com. IN MX
;; ANSWER SECTION:
myshinynewdomain.com. 60 IN MX 0 mail.postale.io.
;; Query time: 32 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: sam. avril 30 20:49:30 CEST 2022
;; MSG SIZE rcvd: 80
Don’t Overlook The Other Important DNS Records for Emails
The MX record is absolutely necessary to have a functional business email address, as we have just seen.
But there are other very important DNS records for emails. In particular, the SPF, DKIM, and DMARC records are essentials in protecting your domain emails from impersonators and preventing your emails from ending up in the spam folders of your recipients.
Granted, these have pretty barbaric names, but they’re really not that hard to understand once you take a look. Check out the related posts below to get a good grasp on them!
Related Posts
-
The SPF Record Explained
If you’re here you’ve probably been asked to configure your domain SPF record while setting up a business email address. If you’re not sure what that is, you’re in the right place! In this post we’ll explain what the SPF record is, and how to set it up correctly. What Is an SPF Record SPF…
-
The DKIM Record Explained
Do you need to set up a DKIM record on your domain DNS, but you’re not sure what it is and how to do it? Search no longer! In this post we’ll explain everything you need to know about DKIM records. What Is a DKIM Record DKIM stands for DomainKeys Identified Mail. It’s a way…