Subdomain Mail when site is hosted remotely

Studio1337

Member
Feb 9, 2016
9
0
51
Tecas
cPanel Access Level
Root Administrator
Hello,

We have an odd hosting situation related to DNS setup on a client, and I just can't seem to get it working properly. I'm hoping someone can give some insights!

The client is hosting email on our server. They have 4 sites hosted with a Website builder. They have email addresses set up on subdomains, and three of the sites use those subdomains. The Web site builder gave us both CNAME and A Record options to point those subdomains to them, but every effort we've made to point to them results in email disruptions.

We can't use the CNAMES - the system sets up A records for subdomains that are used for email, and this doesn't allow the CNAMES to be used. This wouldn't be a problem, except when we enter the A Records, MX gets routed to the remote provider as well, which disrupts their mail service on our server.

I tried setting up separate MX records, which in theory should work just fine, but it's not, and I'm wondering what I've done wrong.

Right now, the records look like this (they gave us two A records and require both - the primary domain A record is also pointed to the 3rd party server):

domain 3600 in A 111.111.111.111
domain 3600 in A 222.222.222.222
domain 3600 in MX 0 domain.com.

subdomain1 3600 in A 111.111.111.111
subdomain1 3600 in A 222.222.222.222
subdomain1 3600 in MX 0 domain.com.

subdomain2 3600 in A 111.111.111.111
subdomain2 3600 in A 222.222.222.222
subdomain2 3600 in MX 0 domain.com.

subdomain3 3600 in A 111.111.111.111
subdomain3 3600 in A 222.222.222.222
subdomain3 3600 in MX 0 domain.com.

The primary domain works as expected. The domain displays the 3rd party Web site, but mail routes to the server.

The subdomains do not work as expected. They display the 3rd party Web sites as they should, but mail is routed to the 3rd party as well, which it should not.

How should we update this so email sent to subdomains stays on our server, but people accessing those subdomains through their browsers are seeing the 3rd party Web sites?

Thanks!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
Hello :)

Could you setup a separate "A" record for "mx.domain.com" and ensure it points to the IP address of the mail server you want the subdomains to utilize. Then, configure the MX records for your subdomains to point to "mx.domain.com". Assuming the DNS records are handled on the cPanel server, and you want the email handled on the cPanel server, choose "Local Mail Exchanger" under the "Email Routing" section when editing the zone.

Thank you.
 

Studio1337

Member
Feb 9, 2016
9
0
51
Tecas
cPanel Access Level
Root Administrator
Thanks for the response Michael. We ended up solving the problem by pointing the MX entries to the server hostname, and this appeared to solve everything. Do you see any downside to this solution?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
I am happy to see the issue is now resolved. It's an acceptable solution to use the server's hostname.

Thank you.