When an MX record points to a CNAME: why it's invalid, and what to fix
An MX record must name a host with its own address record, but it's easy to end up pointing one at a CNAME instead — often by reusing a hostname a CDN already told you to alias. RFC 2181 says this is invalid, not just discouraged. AdminKit's MX lookup tool helps confirm which case applies.
By AdminKit team, Netbase JSC · Updated
Key takeaways
- The host name inside an MX record must have its own A or AAAA record. RFC 2181 §10.3 says it “must not be an alias”, and RFC 5321 §5.1 puts a CNAME there “outside the scope” of SMTP.
- A CNAME on the domain itself is a separate case. Senders follow it, but nothing else, including your own MX, can sit next to it at that name.
- Some senders follow the alias and deliver anyway, so the fault can stay hidden for months and then show up as one provider’s bounces.
- AdminKit’s MX lookup resolves each mail host’s A and AAAA records. A host name showing up among the addresses means the MX target is an alias.
- The fix is a one-line change: point the MX record at the name the alias resolves to, or at the mail host name your provider documents.
What does the rule actually say?
RFC 2181 §10.3, also tracked in the IETF Datatracker, states it directly: “the domain name used as the value of a NS resource record, or part of the value of a MX resource record must not be an alias.” The exchange field of an MX record has to name a host that resolves to an address in its own right — an A or AAAA record at that exact name — not a CNAME pointing somewhere else. The same section adds that this name “can also have other RRs, but never a CNAME RR.”
The rule is older than RFC 2181. It follows from the general constraint in RFC 1034 §3.6.2 that a name carrying a CNAME record shouldn’t carry any other data, and from how RFC 1035 §3.3.9 defines the MX RDATA format: a preference and a host name that gets resolved separately. The mail standard says the same from its side. RFC 5321 §5.1 requires that the MX host name, “when queried, MUST return at least one address record (e.g., A or AAAA RR)”, and that “any other response, specifically including a value that will return a CNAME record when queried, lies outside the scope of this Standard.”
DNS providers repeat it to their customers. AWS’s Route 53 documentation says the MX value must name “an A or AAAA record,” and “RFC 2181… section 10.3 forbids specifying the name of a CNAME record for the domain name value.” RFC 1912, the informational list of common DNS mistakes, gives the exact pattern as “strongly discouraged”.
| Where the CNAME sits | Allowed? | What the standards say |
|---|---|---|
| On the host name an MX record points to | No | RFC 2181 §10.3: “must not be an alias”; RFC 5321 §5.1: “outside the scope of this Standard” |
| On the domain you receive mail for (the name you query MX for) | Yes, but nothing else can live there | RFC 5321 §5.1: the alias target is “processed as if it were the initial name”; RFC 1034 §3.6.2 and RFC 1912 §2.4: no other data beside a CNAME |
On an unrelated name in the same zone (for example www) | Yes | No mail rule applies; just don’t reuse that name as an MX target |
What does an MX-to-CNAME setup look like in a zone file?
The broken pattern is easy to miss because every record in it is individually valid. The following zone fragment is an illustrative example using documentation names and addresses, modelled on the example in RFC 1912 §2.4:
; Broken: the MX target is an alias
example.com. 3600 IN MX 10 mail.example.com.
mail.example.com. 3600 IN CNAME mx1.provider.example.
mx1.provider.example. 300 IN A 192.0.2.25
; Fixed: the MX record names the host that holds the address
example.com. 3600 IN MX 10 mx1.provider.example.
In the broken version, mail.example.com exists and the alias it names resolves to an address. A sender that follows aliases reaches 192.0.2.25. A sender that takes RFC 5321 at its word asks for the address of mail.example.com, gets a CNAME instead, and treats the MX host as unusable.
The fix doesn’t remove the CNAME. Other services may still rely on mail.example.com, for example a webmail login page. Only the MX record changes, so that it names mx1.provider.example directly. If you would rather keep your own name in the MX record, replace the CNAME at mail.example.com with A and AAAA records that hold the provider’s addresses, though you then have to update them by hand whenever the provider renumbers.
Is a CNAME on the domain itself the same problem?
No. This is the case people most often confuse with the first one. RFC 5321 §5.1 describes what a sender does when it looks up MX records for the domain in the recipient’s address: “If a CNAME record is found, the resulting name is processed as if it were the initial name.” So if shop.example.com is a CNAME to shops.platform.example, mail for orders@shop.example.com goes to whatever MX records shops.platform.example publishes. That is defined behaviour, not a violation.
The cost is everything else at that name. RFC 1034 §3.6.2 and RFC 1912 §2.4 say a CNAME “is not allowed to coexist with any other data”. RFC 1912’s own example: if a name is an alias, “you can’t also have an MX record” for it, “or an A record, or even a TXT record.” For a mail domain, that means:
- You can’t publish your own MX record at that name. Mail goes wherever the alias target’s MX records send it, which you may not control.
- You can’t publish an SPF TXT record at that name either, so the domain’s SPF policy is whatever the target publishes, if anything.
- You can’t put a CNAME at a zone apex at all, because the apex must hold SOA and NS records. Providers that offer “CNAME flattening” or ALIAS records work around this by publishing addresses instead. Cloudflare’s CNAME flattening documentation describes the mechanism: it follows the CNAME chain and returns the final IP address instead of a CNAME record. See ALIAS, ANAME and CNAME flattening at the apex explained.
If a subdomain needs its own mail routing, replace the CNAME with the records it actually needs: A/AAAA for the web service and an MX record for mail.
Why does it work for some senders and fail for others?
Because RFC 5321 puts the alias case outside the standard, it doesn’t say what a sender should do with it. Behaviour depends on the sending software and its resolver, which is why the same domain can get mail from one provider and bounces from another.
| Sender behaviour | What happens to your mail | What you see |
|---|---|---|
| Follows the CNAME and connects to the target’s address | Delivered, with an extra DNS round trip on every attempt | Nothing; the fault stays hidden |
| Refuses to treat an alias as an MX host | The MX host counts as having no usable address. If it’s your only MX, mail queues and later bounces | Bounces or delays from some senders only |
RFC 2181 points out the cost even in the lenient case. A DNS server answering an MX query adds the address records for each MX host in the “additional section” of the same response. “Additional section processing does not include CNAME records,” so for an aliased MX host “no address will be returned with the NS or MX value.” Every sender has to make a second query, on every delivery.
When a strict sender gives up on the only MX host, the result looks like a dangling MX record that points at a name with no address at all. See how to read an MX lookup result for what that looks like. If you list several MX hosts and only one is an alias, senders that skip it fall back to the next preference, so the fault shows up as uneven load or slower delivery rather than bounces. What MX record priority actually does covers how that fallback order works.
How does this setup usually happen?
Nobody sets out to point an MX record at an alias. It typically comes from reusing a hostname that was already a CNAME for something else — a CDN endpoint, a marketing automation platform’s tracking domain, or a “vanity” hostname a SaaS provider’s setup instructions said to alias to their infrastructure — and then pointing mail at that same name instead of the dedicated mail host the actual mail provider issued.
Two other patterns lead to the same result:
- A neat-looking
mailname. Someone createsmail.example.comas a CNAME to the provider’s host so the MX record “looks like ours”, without knowing the MX target can’t be an alias. - A migration done in a hurry. The old provider’s CNAME is left in place and the MX record is pointed at it during the cut-over, instead of at the new provider’s host.
How do you check for it with AdminKit?
- Run AdminKit’s MX lookup against your domain. It lists the MX records by priority, then makes a second round of A and AAAA lookups for up to five of the mail hosts. The address columns show every answer the resolver returned for each host. If a host is an alias, that answer includes the alias target’s host name alongside, or instead of, the addresses.
- Query the MX target’s own records directly with AdminKit’s DNS lookup tool, selecting the CNAME record type for that exact hostname. If it returns a CNAME result, the target is an alias, not a proper mail host, and the MX record is invalid under RFC 2181 regardless of whether mail currently appears to be flowing.
- Repeat for every MX host, not just the first. A backup MX at a higher preference number is easy to overlook.
How to read the address columns of an MX lookup result, using illustrative documentation names:
| MX host | A / AAAA answers shown | What it means |
|---|---|---|
mx1.provider.example | 192.0.2.25 / 2001:db8::25 | A real host with its own addresses. Correct |
mail.example.com | mx1.provider.example., 192.0.2.25 | The first answer is a host name, so mail.example.com is an alias. Invalid as an MX target |
old-mx.example.com | none / none | No address at all. A dangling MX host, the failure a strict sender sees for an alias |
If you prefer a terminal, the same two questions look like this with dig. The output below is an illustrative example using documentation names, not a captured response:
$ dig +short MX example.com
10 mail.example.com.
$ dig +short CNAME mail.example.com
mx1.provider.example.
$ dig +short A mx1.provider.example
192.0.2.25
A non-empty answer to the second query is the finding. A correctly configured MX host returns nothing for CNAME and an address for A.
How do you fix it without breaking mail?
Point the MX record at a hostname that has its own A/AAAA record — not an alias of another name. In order:
- Find the real host name. It is usually the name the CNAME points to, or the MX host your mail provider documents. Providers publish a dedicated host specifically because they know it needs a direct address record.
- Publish the new MX record before removing anything. If you’re replacing one MX record, add the corrected one at the same preference, then delete the old one. Both point at the same server, so there is no gap.
- Leave the original CNAME alone if other services use it. The rule constrains the MX value, not the existence of the alias.
- Wait out the old TTL. Senders that cached the old MX answer keep using it until it expires. See DNS propagation and TTL explained for what controls that delay.
- Re-run the MX lookup and confirm every host returns addresses only.
If you own the target name yourself and would rather keep mail.example.com in the MX record, replace its CNAME with A and AAAA records. That is valid, but you take on keeping the addresses current.
Does an aliased MX host affect DANE or other mail security records?
It can. RFC 7672, which defines DANE for SMTP, has to cope with MX host names that turn out to be aliases. When the alias chain is fully DNSSEC-signed, a sending server looks for TLSA records at both the expanded name and the original name, in that order. That works, but it means two names to keep in sync. Per §2.2.2, if the final addresses are not DNSSEC-signed, only the original name is tried, and if the first alias answer is unsigned as well, DANE doesn’t apply to that host at all. Pointing the MX record straight at the real host keeps one name to publish TLSA records for. See how to verify DANE/TLSA for a mail server for the rest of that setup.
Next step
Run AdminKit’s MX lookup tool now to see exactly what your domain’s MX records currently resolve to, and confirm none of them land on a CNAME before mail delivery becomes inconsistent across different senders. This guide is part of AdminKit’s email authentication cluster of SPF, DKIM, DMARC and mail-routing guides and tools.
This guide is general information, not a security audit of your specific network — see our disclaimer for what AdminKit's guidance does and does not commit to.
Frequently asked questions
Is an MX record pointing to a CNAME actually invalid, or just bad practice?
It's invalid per the DNS standard itself, not a style preference. RFC 2181 §10.3 states plainly that "the domain name used as the value of a NS resource record, or part of the value of a MX resource record must not be an alias." This sits alongside RFC 1034 §3.6.2's more general rule that a name carrying a CNAME record should carry no other data at all — the two rules together are why mixing CNAME into mail routing or delegation is treated as a configuration error, not a matter of taste.
Why does it sometimes seem to work anyway?
Some resolvers and mail transfer agents are lenient and will follow the CNAME to find an address anyway, which is exactly why this misconfiguration survives undetected for a long time. RFC 2181 itself notes the practical cost even when a lenient resolver cooperates: looking up an MX target skips the "additional section processing" a direct A/AAAA-bearing name gets, so a sender has to issue an extra DNS round-trip to follow the CNAME before it can even attempt to connect — and strict implementations may simply refuse to use the alias at all, failing delivery outright rather than working slowly.
What actually happens to mail when a receiver's resolver is strict about this?
The lookup for the MX target's address effectively comes back empty from that resolver's point of view, because it isn't willing to treat the CNAME as if it were the address holder. A sending server that can't resolve an MX host to an IP address has nothing to connect to, so mail queues, retries on the usual SMTP backoff schedule, and eventually bounces as undeliverable if the record isn't fixed before the sending server gives up.
How did my MX record end up pointing at a CNAME in the first place?
The most common path is reusing a hostname a third-party service already told you to alias for something else — a CDN, a marketing or tracking platform, or a "vanity" hostname a provider's onboarding instructions said to CNAME to their infrastructure — and then pointing the MX record at that same name instead of at the dedicated mail host the mail provider actually issued. It also shows up after a mail migration where the old setup is cleaned up in a hurry and a leftover alias gets reused by mistake.
What's the fix if my mail provider only gave me a hostname that happens to already be a CNAME somewhere else?
Ask the mail provider for the dedicated mail-host name they expect MX records to point at — reputable providers publish one specifically because they know it needs an A/AAAA record, not an alias. If a hostname is already in use as a CNAME target for something unrelated on your side, publish a separate hostname with its own A/AAAA record for mail and point the MX record at that instead, rather than trying to make one name serve both roles.
My whole domain is a CNAME. Is that the same problem?
No, it is a different one. RFC 5321 §5.1 says that if the MX lookup for the domain itself finds a CNAME, the sender processes the alias target as if it were the original name, so mail follows the alias to the target's MX records. The catch is RFC 1034 §3.6.2 and RFC 1912 §2.4: a name that holds a CNAME cannot hold anything else, so you cannot publish your own MX, SPF or other records at that name alongside it.
Sources
- CNAME flattening · Cloudflare DNS docs
- RFC 2181 — Clarifications to the DNS Specification, §10.3 (NS and MX values must not be an alias)
- RFC 1034 — Domain Names: Concepts and Facilities, §3.6.2 (a name with a CNAME should carry no other data)
- RFC 1035 — Domain Names: Implementation and Specification, §3.3.9 (MX RDATA format)
- IETF Datatracker — RFC 2181 (Clarifications to the DNS Specification)
- AWS — Route 53 supported DNS record types, MX record type (RFC 2181 forbids a CNAME as the MX target)
- RFC 5321 — Simple Mail Transfer Protocol, §5.1 (Locating the Target Host)
- RFC 1912 — Common DNS Operational and Configuration Errors, §2.4 (CNAME records)
- RFC 7672 — SMTP Security via Opportunistic DANE TLS, §2.2.3 (TLSA record lookup for aliased MX hosts)
Want AdminKit to watch this for you?
Free checks tell you the state today. Protective DNS and monitoring tell you when it changes.
Talk to an expert
Huy Nguyen (David), Founder & CEO, Netbase JSC
Ask whether this fix applies to your setup, or get a second pair of eyes on your DNS and mail records.