Insights

MX Record Points to a CNAME and Mail Breaks? Read dig Output to Find the RFC Violation

November 23, 2026
0:00
Someone reports that mail to their domain works most of the time but occasionally bounces or gets delayed for hours. The MX record looks correct at a glance. The domain resolves. Yet certain sending servers reject or defer messages with cryptic temporary errors. The culprit, buried one lookup deep: the MX record's target hostname is a CNAME alias, not a direct A or AAAA record. This violates two RFCs and causes behavior that varies wildly depending on which mail server is doing the sending.
The pattern that makes this problem hard to catch is its inconsistency. Some mail servers follow the CNAME chain anyway and deliver successfully. Others refuse to, returning a temporary failure (4xx) or permanent rejection (5xx). A third group defers the message and retries, so mail arrives hours late. Because most big providers (Gmail, Outlook) tend to be lenient and follow the chain, the domain owner sees mail flowing fine in their own inbox. The failures only surface when a stricter MTA (Mail Transfer Agent — the software that routes email between servers) tries to deliver. Support tickets for this look like "some people can't email me" with no obvious pattern. The sender gets a bounce, the recipient never sees anything, and a quick MX lookup returns a hostname that appears valid.
The first diagnostic step is straightforward — query the MX record:
BASH
dig MX example.com +short
Illustrative output format:
TEXT
10 mail.example.com.
That looks normal. Priority 10, target mail.example.com. The problem only appears when you query the target hostname's record type:
BASH
dig A mail.example.com +short
If this returns an IP address directly, the setup is correct. But if the answer section shows a CNAME instead of an A record, that is the violation:
TEXT
mail.example.com.    300    IN    CNAME    loadbalancer.hostingprovider.net.
loadbalancer.hostingprovider.net.    60    IN    A    203.0.113.50
The MX target mail.example.com is not an A record. It is a CNAME that points to another hostname, which then resolves to an IP. That extra indirection is what breaks things. For a more detailed view showing the full answer section and authority records, drop the +short flag:
BASH
dig A mail.example.com
Look at the ANSWER SECTION in the output. If you see a line with IN CNAME before the IN A line, the MX target is aliased.
RFC 2181 (Section 10.3) states that MX records must not point to a CNAME alias. RFC 5321 (Section 5.1), which defines SMTP, reinforces this: the target of an MX record must be a hostname that resolves directly to one or more address records (A or AAAA), not to another alias. The reasoning is practical, not bureaucratic. When a sending MTA looks up the MX for a domain, it expects to get a hostname, then resolve that hostname to an IP in one step. Adding a CNAME in the middle creates several problems: Extra DNS lookups under time pressure. SMTP has timeouts. An additional CNAME resolution adds latency and another point of failure. If the CNAME target's authoritative nameserver is slow or unreachable, the entire mail delivery attempt fails — even though the MX record itself resolved fine. Resolver behavior is not guaranteed. Some DNS resolvers flatten the CNAME chain and return the final A record in one response. Others return just the CNAME and expect the client to make a second query. MTAs that strictly follow the RFC will not make that second query because they do not expect a CNAME in the first place. Caching inconsistencies. The CNAME and the final A record typically have different TTLs (Time To Live — how long a resolver caches the answer). When the CNAME's TTL expires but the cached A record is stale, or vice versa, resolvers can return inconsistent results. This is why the failures are intermittent. Whether mail gets through depends on the sending server's MTA software, its DNS resolver's behavior, cache state, and network conditions at that moment.
Nobody usually creates this violation on purpose. Common scenarios:
  • A hosting migration where someone pointed mail.example.com as a CNAME to the new provider's hostname, the same way they pointed www. The www CNAME works fine for HTTP. The mail CNAME silently breaks RFC compliance.
  • A load balancer or CDN setup where the provider instructs users to create CNAME records for all subdomains. The instructions do not distinguish between web-serving subdomains and mail-serving ones.
  • DNS zone templates that default to CNAME for everything except the apex domain.
The fix is always the same, but the path to discovering the problem often takes a while because the person who set up DNS months ago is not the person debugging bounced mail today.
If mail is actively bouncing and you need to stop the bleeding before making DNS changes (which take time to propagate), there is not much you can do on the receiving side. The problem is in how sending servers interpret your DNS. However, lowering the TTL on the offending CNAME record to something short (like 300 seconds) before changing it to an A record will speed up propagation of the fix once you apply it. If you have access to the sending side (for example, you control both domains), you can add the destination IP directly to the sending MTA's transport table, bypassing DNS entirely. This is a stopgap, not a solution.
Replace the CNAME with a direct A (and/or AAAA) record pointing to the mail server's IP address. Before the fix, the zone might look like this:
TEXT
example.com.         IN    MX    10 mail.example.com.
mail.example.com.    IN    CNAME  loadbalancer.hostingprovider.net.
After the fix:
TEXT
example.com.         IN    MX    10 mail.example.com.
mail.example.com.    IN    A      203.0.113.50
If the mail server has an IPv6 address, add an AAAA record too:
TEXT
mail.example.com.    IN    AAAA   2001:db8::50
The trade-off: you lose the automatic-follow behavior of a CNAME. If the hosting provider changes the mail server's IP, you need to update the A record manually. With a CNAME, the change would have propagated automatically (when it worked at all). This is a worthwhile trade-off. Reliable mail delivery matters more than convenience of IP changes, which happen rarely. After making the change, verify it:
BASH
dig MX example.com +short
dig A mail.example.com +short
The first command should return your MX target hostname. The second should return an IP address directly, with no CNAME in the chain. If you want to be thorough, run dig A mail.example.com (without +short) and confirm the ANSWER SECTION contains only an A record, no CNAME.
If you manage multiple domains, a quick audit pattern: query MX, extract the target, query A for that target, look for CNAME in the output. In a shell one-liner:
BASH
for mx in (dig MX example.com +short | awk '{print2}'); do echo "--- mx ---"; dig A "mx" +short; done
If any result shows a hostname instead of an IP, that MX target is a CNAME and needs fixing. For domains using external mail services (Google Workspace, Microsoft 365, and similar), the MX targets provided by those services already resolve directly to A records. The CNAME-as-MX-target problem typically appears with custom mail hostnames managed in your own DNS zone. Related reading: if you have been chasing DNS issues around mail subdomains, the article on AutoSSL skipping the mail subdomain due to DNS pointing covers a related scenario where mail.example.com DNS configuration causes certificate issuance failures. And if you suspect a broken CNAME target is causing resolution failures beyond just mail, testing whether a broken CNAME target causes SERVFAIL walks through that diagnostic.
When mail delivery is intermittent and the MX record looks correct, always follow the chain one step further. Run dig A against the MX target hostname. If you see a CNAME in the answer, that is your problem. Replace it with a direct A (or AAAA) record. The RFC violation is clear, the fix is a single DNS record change, and the result is mail that stops failing on strict MTAs.
Verified Sources & Citations

Join My Newsletter & Get Updates!

Get notified whenever a new technical guide, server infrastructure breakdown, or personal reflection goes live, plus a curated weekly digest.