A new domain is set up on a cPanel host. The customer’s website works, the customer’s mail accounts work. Six months later they migrate mail to Google Workspace. The MX is set to Google’s mail servers. Some mail still arrives at the cPanel host. The team adds more debugging logs and is surprised to find that some senders are ignoring the MX entirely and sending to the A record. They aren’t ignoring it — they’re following RFC 5321 to the letter.
What’s happening
RFC 5321 §5.1 defines how an SMTP sender finds the destination host. The process:
- Query the MX records for the destination domain.
- If MX records exist, sort by priority and use the lowest priority that responds.
- If no MX records exist, fall back to the A (or AAAA) record at the apex — this is called “implicit MX”.
The implicit MX fallback is older than most operators today. It’s there for domains that don’t bother publishing MX records and expect mail to land on whatever the web server’s IP is. It also kicks in when the MX records exist but all targets fail to resolve or refuse connections.
The trap: a domain that previously had no MX (relying on the implicit MX to deliver to the cPanel host) gets explicit MX records pointing to a new mail provider. The new MX takes most traffic, but if the new mail provider has a temporary outage, the sender falls back to the implicit MX — which is still the cPanel host. Mail arrives at the cPanel host, sits in Exim’s queue, and either bounces (if the domain is in /etc/remotedomains) or gets delivered locally (if still in /etc/localdomains).
How to verify
Check explicit MX:
dig +short MX example.com
If empty, the implicit MX applies — check the A:
dig +short A example.com
That’s where SMTP senders will deliver in the absence of MX.
Check whether the cPanel host considers the domain local:
grep example.com /etc/localdomains /etc/remotedomains
A domain in localdomains will accept and locally deliver mail to A. A domain in remotedomains will refuse mail and bounce.
Force a sender’s view:
dig +short MX example.com @1.1.1.1
swaks --to test@example.com --server $(dig +short A example.com) --quit-after RCPT --to test@example.com
If the cPanel host accepts the RCPT, it’ll deliver locally. If it rejects, it bounces.
What to do
- Always publish explicit MX records for any domain that handles mail. Even if the MX points to the same server as the A record, the explicit MX makes the intent clear and prevents fallback ambiguity.
- When migrating mail away from cPanel, after updating the MX:
- Set the domain’s mail routing to “Remote Mail Exchanger” in WHM > Email Routing.
- Remove the domain from
/etc/localdomainsif it’s there. - Confirm
/etc/remotedomainslists the domain.
- For domains hosted at cPanel with no separate mail provider, point MX at the cPanel host’s
mail.example.comand ensure that A record matches the server IP. The implicit-MX path becomes irrelevant. - Audit on takeover. A customer-managed domain may have years of accreted misconfiguration. List all domains, query MX and A, and flag any that have an MX but mail is still arriving at the host’s A.
- Watch the Exim queue for unexpected accepted mail:
exim -bp | head
grep example.com /var/log/exim_mainlog | grep accept | tail
If you see acceptance for a domain that’s supposed to be at an external provider, the routing or domain-classification is wrong.
The single most common variant of this misconfiguration: a domain’s MX moves to Google Workspace, but the cPanel host’s mail routing still says “Local Mail Exchanger”. Both records exist, both servers accept mail, and mail randomly ends up at one or the other.
Stack Harbor fixes mail-routing inconsistency during mail migrations in migration solutions.