13 min read Diesen Artikel auf Deutsch lesen Lire cet article en français Ler este artigo em português

What Are MX Records? How Mail Routing Works

The short answer

An MX record is a DNS entry that names the server accepting mail for a domain, along with a preference value. A sending server looks up the recipient domain's MX records and tries the lowest value first. If that server is down, it moves on to the next one. MX only handles incoming mail. SPF, DKIM and DMARC are separate records that authenticate the mail you send. To check your MX records, run dig MX yourdomain.com.

In this article

What are MX records and what do they tell a sending server?

MX records are DNS entries that tell other mail servers where to deliver email for a domain. Each one pairs a mail server's hostname with a preference value, and senders try the lowest value first. The core DNS specification gives the record exactly two data fields: the preference and the hostname of the mail exchanger.

MX stands for mail exchange. The record answers one question: which machine should receive mail addressed to @example.com? It holds a hostname, not an IP address. The sending server then looks up that hostname's A or AAAA record to get the address it connects to over SMTP. In a zone file, a complete record lists the domain name, a TTL, the class IN, the type MX, the preference value and the target hostname, in that order. The table below takes that line apart field by field.

Field Example value What it means
Name example.com. The domain the record belongs to, which is the part after the @ in an address
TTL A value in seconds that you or your DNS host set How long resolvers may cache the answer before they ask again
Class IN Internet class, used by practically every record
Type MX Marks the record as a mail exchanger
Preference A whole number Lower values are tried first, and equal values share the load
Target mail.example.com. The hostname of the server that accepts the mail. It needs its own A or AAAA record
The fields of one MX record, read from left to right in a zone file

The trailing dot after the target marks a fully qualified name. If you leave it out of a raw zone file, many DNS servers append the zone name, and the record ends up pointing at mail.example.com.example.com, which doesn't exist. Most web DNS panels add the dot for you, but not all of them do.

Illustration for the question “What are MX records and what do they tell a sending server?”
AI-generated image

How does a mail server use MX records to deliver email?

The SMTP standard describes the lookup. When a message is sent to anna@example.com, the sending server goes through these steps:

  1. It takes the domain after the @ and asks DNS for that domain's MX records.
  2. It sorts the answers by preference, lowest value first.
  3. If several records have the same preference, it picks one at random, which spreads the load across equal servers.
  4. It resolves the chosen hostname to an IP address and opens an SMTP connection.
  5. If that server can't be reached, it tries the next preference. If none of them respond, it keeps the message in its queue and retries until its own give-up time runs out, then returns a bounce to the sender.
  6. If the domain has no MX record at all, it falls back to the domain's own A or AAAA record and treats that as an implicit MX.

The last step catches people out. If a domain has no MX record but does have an A record for its website, senders will try to deliver mail to the web server. To say clearly that a domain accepts no mail, the null MX standard defines a single MX record whose target is just a dot. Senders who see it give up straight away instead of queuing and retrying.

What is a backup MX record, and when does it cause trouble?

A backup MX is a second record with a higher preference value than the primary. It points at a different server that queues mail while the primary is down. With hosted mailboxes from Google Workspace or Microsoft's Exchange Online you usually don't need one, because the provider's hostname already runs on redundant infrastructure.

Backup MX setups fail in three common ways. A backup server that doesn't know which mailboxes exist accepts mail for any address and bounces it later, which sends backscatter to forged senders. Spammers target high-preference MX hosts on purpose, because those hosts often filter less. And after a migration, an old MX left at the same or a lower preference value keeps receiving some of your mail on a server nobody reads. When you change provider, delete the old records rather than just adding new ones.

Illustration for the question “What is a backup MX record, and when does it cause trouble?”
AI-generated image

Can MX records point to a CNAME or an IP address?

Neither works. The DNS standards say the target of an MX record must not be an alias, so it has to be a name with its own A or AAAA record. Some resolvers will follow a CNAME anyway, but you can't count on that, and some mail servers reject the setup. A bare IP address in the target field fails as well. The field expects a hostname, so the address gets read as a name and the lookup fails. To route mail to a specific IP, create an A record such as mail.example.com that points to the IP, then point the MX at mail.example.com.

Where do I find my MX record?

You can check in two places. The zone editor at your DNS host shows what you configured, and a public lookup shows what the rest of the internet sees. After a change, the two can disagree until the old TTL runs out, because resolvers serve the cached answer until then. They can also disagree permanently if your domain's nameservers point to a different provider from the one you're editing. That second case is a common reason a new record never seems to show up. Run dig NS example.com +short to see which provider is actually authoritative, and edit the zone there.

Lookup method How you run it What it shows Where it stops
dig (Linux, macOS) dig MX example.com +short The preference and host of each MX record, as returned by your configured resolver Returns cached answers from your resolver. Add @ and a public resolver's address to compare against another source
nslookup (Windows, macOS, Linux) nslookup -type=mx example.com The MX preference and mail exchanger hostname Output is wordier, and the same resolver caching applies
Google Admin Toolbox Dig (web) Enter the domain at toolbox.googleapps.com and choose MX The same DNS answer, queried from Google's side Shows raw records only and doesn't say whether they're right for your provider
MXToolbox MX Lookup (web) Enter the domain on mxtoolbox.com The MX records plus their resolved IPs and some follow-up checks Applies its own checks to the results. Read the raw records before acting on any warning
Ways to look up MX records. As of November 2026.
Illustration for the question “Where do I find my MX record?”
AI-generated image

What are the MX records for Gmail and Google Workspace?

For a domain on Google Workspace, Google's admin help page on setting up MX records currently recommends a single MX record pointing to smtp.google.com, with the priority value given on that page. Older setups use the ASPMX.L.GOOGLE.COM host plus several ALT hosts at higher priority values. Google still accepts that older set, so you don't need to replace a configuration that works. Don't mix either set with records left over from a previous provider. Free gmail.com addresses need nothing from you, because Google runs the gmail.com zone itself.

When you move a domain to Google Workspace, delete the previous provider's MX records in the same edit. If an old record keeps a lower preference value, sending servers keep trying it first, and mail lands in the old mailbox until that server stops answering. Resolvers that cached the old set also keep delivering there until its TTL expires. The MX record doesn't let Google send mail for your domain, either. That needs an SPF include and a DKIM key, which are separate records. Both are covered in our guide to Google Workspace DNS records for MX, SPF and DKIM.

Do I need an MX record to send emails?

Not to send. Outgoing SMTP connects to the recipient's MX, not to yours. You do need one for almost everything that comes back: replies, and the bounce messages sent to your envelope sender (Return-Path) address. Without a working MX on that domain, replies fail and bounce notices are lost. Some receiving servers also check the sender's domain. In Postfix, the reject_unknown_sender_domain restriction rejects mail from a sender domain that has neither an MX nor an A record, and by default it answers with a temporary failure code rather than a permanent one. Cold outreach depends on seeing every bounce so you can clean your list, and a sending domain without an MX hides them from you.

Illustration for the question “Do I need an MX record to send emails?”
AI-generated image

Which DNS records does email need?

When people ask which DNS records email needs, they usually mean the five records below. MX handles incoming mail. The others let a receiving server check that mail claiming to come from your domain was actually authorised by you.

Record DNS type and location What it does Specification
MX MX at the domain itself Names the servers that accept incoming mail for the domain, in order of preference Core DNS specification (record format) and the SMTP standard (how senders use it)
SPF TXT at the domain, starting with v=spf1 Lists the servers allowed to send mail with the domain in the envelope sender SPF specification
DKIM TXT, or a CNAME to the provider's key, at selector._domainkey.domain Publishes the public key that verifies the signature in the message header DKIM specification
DMARC TXT at _dmarc.domain Tells receivers what to do when SPF or DKIM doesn't align with the From domain, and where to send reports DMARC specification
PTR (reverse DNS) PTR in the reverse zone of the sending IP Maps the sending IP back to a hostname. It's set by whoever owns the IP, usually your sending provider Core DNS specification
DNS records involved in sending and receiving email, with the specification that defines each

In cold email, the usual failure isn't a missing MX. It's an SPF, DKIM or DMARC record that doesn't match the service actually sending the mail. Our overview of SPF, DKIM and DMARC for cold email senders explains how the three records work together.

What is a DNS mail record?

"DNS mail record" usually means the MX record, which is the only record that decides where incoming mail for a domain is delivered. Sometimes people use it to mean the whole set of email-related records. In that wider sense it also covers the TXT records for SPF, DKIM and DMARC. Those records don't route anything. They tell receivers whether mail sent under your domain is authorised. One practical rule follows from that split. If replies aren't arriving, check the MX. If your sent mail is being rejected or filtered, check SPF, DKIM and DMARC. Changing the MX won't fix an authentication failure, and changing SPF won't fix a reply that never arrives.

What does Google's SPF record look like?

Google Workspace documents its SPF record as v=spf1 include:_spf.google.com ~all, published as a TXT record at the root of your domain. A domain may have only one SPF record. If you also send through Brevo or another service, add its include to the same line, for example v=spf1 include:_spf.google.com include:other-provider ~all. Don't create a second record starting with v=spf1, because the SPF specification makes two records return a permerror. The same specification caps the number of DNS lookups one check may trigger. Every include counts toward that cap, and so do the includes nested inside it. Going over the cap also returns a permerror, and it's a common cause of SPF failures.

What does a DMARC record example look like?

A starter DMARC record is a TXT record at _dmarc.example.com with the value v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com. The DMARC specification requires the record to start with that version tag. The p tag sets the policy: none only monitors, quarantine asks receivers to treat failing mail as suspicious, and reject asks them to refuse it. The rua tag says where aggregate XML reports go. Starting with p=none shows you which services send as your domain before you tighten the policy. Our DMARC setup guide covers the tags, how to read the reports and common fixes, and the GoDaddy walkthrough shows where the record goes in that panel.

How EmailFlow OS relates to your MX and sending records

EmailFlow OS doesn't change your MX records, and it doesn't send through a shared platform address. You connect your own Brevo account and your own sending domain. Messages go out from your inbox, so receivers check DNS records that you control, and replies come back through your MX to a mailbox you already read. You record one video, upload it and import your prospect list into EmailFlow OS. EmailFlow OS then makes a separate personalised version of that recording for each recipient and sends each version through your Brevo account. Because the MX, SPF, DKIM and DMARC records are yours and not ours, check them before you start. The EmailFlow OS home page describes how the product works.

Illustration for the section “How EmailFlow OS relates to your MX and sending records”
AI-generated image

Questions people ask

What are MX records used for?
MX records tell sending mail servers which hostname accepts email for a domain and in what order to try them. Under the SMTP standard, the MX lookup is the first step of every delivery. SPF, DKIM and DMARC are TXT records that authenticate outgoing mail. MX is different: it only routes incoming mail, including replies and bounces to your own domain.
What does the number in an MX record mean?
It's the preference value, a field defined in the core DNS specification. Sending servers try the lowest value first and only move to higher values when the lower servers can't be reached. Records with the same value share the load, because the SMTP standard tells senders to choose among them at random. Only the order matters. The size of the gaps makes no difference.
How long does an MX record change take to work?
It depends on the TTL of the old record, which is set in seconds. Resolvers that cached the old answer keep using it until that TTL runs out, so a long TTL means a long changeover window and a short one means a short window. Lowering the TTL well before a planned migration shortens it. A change made at a DNS host your nameservers don't point to never takes effect.
Is an MX record the same as an A record?
No. An A record maps a hostname to an IPv4 address. An MX record maps a domain to the hostname of its mail server, and that hostname needs its own A or AAAA record, because the DNS standards forbid pointing MX at an alias. MX adds priority and fallback on top of the address lookup. If a domain has no MX at all, the SMTP standard tells senders to fall back to its A record.
Can a domain have MX records from two providers at once?
Technically yes, but mail is then split between the two providers by preference and random choice, so some messages end up in a mailbox nobody checks. If Google's smtp.google.com and an old provider's host have the same preference, senders choose between them at random for each delivery. Splitting delivery on purpose needs routing that both providers set up deliberately. Otherwise, keep only your current provider's documented records.

Share

LinkedIn X

Keep reading

All articles