Table of Contents

When someone sends an email to your domain, how does it know which server to deliver to? The answer is the MX record — the piece of DNS that acts as the postal address for your domain’s email. If you have ever set up a professional email address or wondered why your messages are not arriving, the MX record is where the story begins, and understanding it makes email setup far less mysterious.

This guide explains what an MX record is using a simple postal analogy, breaks down its components (priority, hostname, and TTL), shows how mail routing and failover actually work, and walks through common setups with providers. You will also learn why MX records must point to a hostname rather than a CNAME, and how they relate to the TXT records that keep your email trusted and out of spam folders.

Animated illustration of website files on a server going live to a website in the cloud

Did you know?

MX stands for Mail Exchange. Think of it as the postal address for your domain’s email: it tells every sending mail server exactly which server is responsible for receiving messages addressed to your domain.

What an MX record is

An MX (Mail Exchange) record is a DNS record that tells sending mail servers where to deliver email for your domain. It is essentially a digital postal address: when someone emails you@yourdomain.com, the sending server looks up your domain’s MX record to find the mail server responsible for handling your incoming messages, then delivers there.

Without a correct MX record, email to your domain has nowhere to go and will fail to arrive. The MX record is what links your domain name to your email provider’s servers — whether that is a dedicated email service or the mail service included with your hosting.

So while an A record points your domain to a website and a CNAME creates aliases, the MX record has one specific, vital job: routing your email to the right destination. It is the foundation of receiving mail at your own domain.

The postal analogy

Imagine your domain is a building and email is physical mail. The MX record is the address on the envelope that tells the postal system which building — which mail server — to deliver to. Sending servers around the world consult it exactly like a courier reading a delivery address.

Just as a large organisation might have a main mailroom and a backup, your domain can list more than one mail server in its MX records, with a priority order deciding which is tried first. If the primary mailroom is unavailable, mail is delivered to the backup, so nothing is lost.

This analogy captures the essence: the MX record does not store your email or send it; it simply directs incoming mail to the correct receiving server. Everything about configuring email deliverability starts with getting that address right.

The components of an MX record

An MX record has a few key parts, and understanding them makes setup and troubleshooting straightforward:

  • Priority: a number that sets the order in which mail servers are tried. Lower means higher priority — a server at priority 10 is tried before one at priority 20.
  • Hostname (mail server): the domain of the server responsible for your mail, such as a hostname your email provider gives you. It must point to a valid A/AAAA record, never a CNAME.
  • TTL: time to live — how long the record may be cached before being checked again, like any DNS record.

The priority and hostname are the parts you actively configure. Your email provider tells you exactly which hostname(s) and priority values to enter, and you add them as MX records in your DNS panel. TTL can usually be left at its default.

How mail routing and failover work

When a message is sent to your domain, the sending server looks up all your MX records and picks the one with the lowest priority number (the highest priority) that is available. It attempts delivery there first, which is why your primary mail server should carry the lowest number.

If that primary server cannot be reached — because it is down or busy — the sending server moves to the next MX record in priority order and tries that one. This is failover: by listing multiple mail servers at different priorities, you create redundancy so email is not lost during an outage.

Many setups use a single MX record (or a set provided by one email provider), which is perfectly fine. Multiple records with staggered priorities are for redundancy. Either way, the priority numbers are the routing logic that decides the order servers are attempted.

Common MX setups

In practice, you rarely invent MX records yourself — you copy the ones your email provider specifies. When you sign up for a business email service or use your host’s mail feature, the provider gives you exact MX records (hostnames and priorities) to add to your domain’s DNS.

For example, a popular email suite might have you add several MX records pointing to its mail servers at set priorities, while your hosting company’s email service will give you its own hostname to point to. The steps are always the same: open your DNS editor, add the MX records exactly as provided, and save.

The key is to enter them precisely and to remove any old or conflicting MX records that point elsewhere, since leftover records can misroute mail. Once the correct MX records propagate, email addressed to your domain will flow to the right inboxes.

Pro Tip

When switching email providers, remove the old MX records before or as you add the new ones. Leftover records pointing at your previous mail server can misdeliver messages or cause confusing, intermittent delivery failures.

MX records must point to a hostname, not a CNAME

A technical rule worth knowing: an MX record must point to a hostname that resolves via an A or AAAA record — it cannot point to a CNAME. The mail standards require the target to be a real host address, and pointing an MX at a CNAME can cause delivery problems or outright rejection by some servers.

In everyday terms, this means the hostname you enter in an MX record should be a proper mail-server name (which itself has an A/AAAA record behind it), not an alias. Your email provider’s supplied hostnames are already set up correctly for this, so as long as you use exactly what they give you, you will be fine.

This rule mainly matters if you are tempted to alias your mail hostname or reuse a CNAME. Do not — keep MX targets as direct hostnames, and let your provider’s configuration handle the rest.

MX records and email security (SPF, DKIM, DMARC)

Getting mail delivered is only half the picture; getting it trusted is the other half. MX records route your incoming email, but your outgoing email’s trustworthiness depends on TXT records holding SPF, DKIM, and DMARC — the standards that prove your messages are genuine and stop scammers from forging your domain.

These work alongside your MX setup. SPF lists which servers may send mail for your domain, DKIM adds a cryptographic signature to your messages, and DMARC tells receiving servers how to handle mail that fails those checks. Together they keep your email out of spam folders and protect your domain’s reputation.

So a complete email configuration usually means correct MX records for receiving mail plus the right TXT records for authentication. When you set up email with a provider, they typically supply both — add them all, and your domain will send and receive mail reliably and securely.

Setting up email on your domain?

Hostinger makes adding MX and TXT records simple in its DNS editor and offers email hosting to go with your domain, so you can get professional, reliable email running quickly — with a free domain included on its hosting plans.

See Hostinger plans

FAQs

What is an MX record?

An MX (Mail Exchange) record is a DNS record that tells sending mail servers where to deliver email for your domain. It acts as your domain’s postal address for email: when someone messages you@yourdomain.com, their server looks up your MX record to find the responsible mail server and delivers there. Without a correct MX record, email to your domain will not arrive.

What does priority mean in an MX record?

Priority is a number that sets the order in which your mail servers are tried, with lower meaning higher priority — a server at priority 10 is attempted before one at priority 20. This lets you list a primary server and backups: if the primary is unreachable, sending servers fall back to the next in line, providing redundancy for your email.

Do I need an MX record to receive email?

Yes. To receive email at your domain, you need correct MX records pointing to your mail server. They tell sending servers where to deliver messages addressed to your domain. Your email provider or host supplies the exact MX records to add; without them, incoming mail has no destination and will fail to be delivered.

Can an MX record point to a CNAME?

No. An MX record must point to a hostname that resolves through an A or AAAA record, not a CNAME. Mail standards require a real host address, and pointing an MX at a CNAME can cause delivery failures or rejection. Use the direct mail-server hostnames your email provider gives you, which are already configured correctly.

How do MX records relate to SPF, DKIM, and DMARC?

MX records route your incoming email, while SPF, DKIM, and DMARC — stored as TXT records — authenticate your outgoing email so it is trusted and not forged. They work together: MX gets mail delivered to you, and the TXT-based standards keep your sent messages out of spam and protect your domain from spoofing. A full setup uses both.

How do I set up MX records?

Get the exact MX records (hostnames and priorities) from your email provider or host, open your domain’s DNS editor, add each as an MX record precisely as given, remove any old conflicting MX records, and save. Allow time for propagation, and consider adding the provider’s SPF, DKIM, and DMARC TXT records too for reliable, secure email.

The bottom line

An MX (Mail Exchange) record is the postal address for your domain’s email: it tells every sending mail server which server is responsible for receiving messages addressed to your domain, so without a correct one, email simply cannot arrive. Each record carries a priority (lower is tried first, enabling backup servers and failover), a hostname (the responsible mail server, which must resolve via an A/AAAA record and never a CNAME), and a TTL. Sending servers read these exactly like a courier reading a delivery address.

In practice you copy the MX records your email provider or host supplies, enter them precisely, remove any old conflicting ones, and let them propagate. Because MX records only handle receiving, a complete, trustworthy email setup pairs them with TXT records for SPF, DKIM, and DMARC, which authenticate your outgoing mail and keep it out of spam. Get the MX routing right and add the authentication records, and your domain will send and receive email reliably and securely.

When you are ready, you can start with Hostinger and use code PROTIPS for the reader discount. An MX record is your domain’s email postal address — it routes incoming mail to the right server, using priority numbers for failover. Point it to a hostname (not a CNAME) and pair it with SPF/DKIM/DMARC TXT records.

Scroll to Top