Emails trying to deliver locally even though domains / subdomains have different mx records

email
mx

#1

I have two domains registered with cloudflare nameservers. They both have A records pointing to my web server, however the MX records are different for the two domains. One’s mail is hosted on cpanel, (Domain 2) and the other with GSuite (Domain 1).
I have an issue when trying to send emails from a CPanel address on one domain (Domain 2) [and also from CPanel hosted mail for subdomains of Domain 1] to a GSuite address on the other domain (Domain 1), I get a bounce back saying that no such user exists there.
I contacted my hosting provider about this and they said that it is an issue with Cloudflare and that, because the nameservers are pointing to Cloudflare on both domains, it is attempting to deliver the emails locally. This does not work though as the other domain’s emails are with GSuite and not on the same server.

Can anyone help please?


#2

Huh… that’s an interesting take on the problem. If your Mx records are right and everyone else on the planet can send you email it seems amazing that there is a problem with Cloudflare that only effects your server.

More likely the problem is that you webserver is not using public DNS for resolution for these zones but is instead resolving based on DNS entries in the local cpanel or hosting provided DNS which don’t match those you have in Cloudflare.

As far as I know there are a bunch of different DNS management plug-ins for cpanel, so not sure exactly where you would find it. Mine looks sort of like this with my provider https://marketplace.whmcs.com/product/642 you can change the Mx record for your google hosted zone’s Mx records here to point ot Google and that should resolve the issue.


#3

What I’m seeing is you have some part of both domains listed in your cPanel.

My theory is you told cPanel you want to set up a subdomain of #1, but cPanel reserves a spot for the root domain of #1. Since #2 is hosted on the same cPanel as (sub)domain #1, you try to mail from #2 to #1, and cPanel says "Hey, that domain is right here, so there’s no need to look it up. Unfortunately, you don’t have email accounts for #1 on cPanel, so it bounces.

You need to find a way to trick cPanel into pretending #1 isn’t hosted there. Or at least force it not to stay local for email. Can you edit your DNS Zone #1 in cPanel and add the Google MX entries?


#4

Thanks for the replies. That’s a good thought to try and edit the DNS records on cpanel as well. I will try it and let you know!


#5

Thank you much. I added the GSuite MX records to the DNS zone on my cPanel. I had never changed anything there before but there was an MX record pointing from my domain to itself which I removed and the emails work fine now.

This was the first time I have posted on the Cloudflare community and I am really impressed.

Thanks again for the great advice and help

Dom


#7

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.