Route email to smarthost

Kenny M.

Registered
Mar 21, 2017
4
0
1
New York, NY
cPanel Access Level
Root Administrator
Now I'm not an idiot but not a Linux or Cpanel expert.

So the problem:
GoDaddy VPS has several sites
domain1.com
domain2.com

Now the server is able to send emails to unrelated domains and it works fine. The problem is trying to get the server to send emails to domain2.com whose email is hosted on my in-house mail server.

Instead of looking at my MX records it seems to be trying to route it internally on the server and send to itself.
I thought I would add a Smarthost for domain2.com pointing to my server based on Setting up a smarthost for specific domains thedisgruntledadmin.com/cpanel-setting-up-smarthost-for-specific-domains/


I got past "Step 1", but when I got to step 2 This is what I already have in the ROUTERSTART section:
send_to_smart_host:
driver = manualroute
route_list = !+local_domains dedrelay.secureserver.net
transport = remote_smtp


Maybe that was created by the previous commands or it was already there, I don't know?
Anyway I didn't want to delete what was there and delete dedrelay.secureserver.net but when I added "route_data = ${lookup{$domain}partial-lsearch{/etc/staticroutes}}" to the bottom it says you can't use route_data and route_list together so I'm not sure how to proceed past step 2


Basically the end game is I want to specify a smarthost for domain2.com and let everything else continue to relay through dedrelay.secureserver.net

Everything I found on the forum seemed to be centered around specifying a global smart host for everything.


I'm also wondering if simply deleting !+local_domains might solve my problems by preventing the internal relaying?


Any help is enormously appreciated.

Thanks,

Kenny
 
Last edited by a moderator:

Kenny M.

Registered
Mar 21, 2017
4
0
1
New York, NY
cPanel Access Level
Root Administrator
I finally got it working by adding my published MX records on the CPanel for the site on domain2.com under "Email->MX Entry"
That got it working.

My concern now is will it keep working???
That MX Entry screen has a big yellow banner:
Warning: This interface is deprecated and will be removed in a future release.

So is my fix only temporary and everything is going to break when the next upgrade rolls around?



And just a note for any other amateurs my idea for changing (granted not knowing what I'm doing completely):
route_list = !+local_domains dedrelay.secureserver.net
To:
route_list = dedrelay.secureserver.net

That just broke all email on the server so I changed it back, no permanent damage.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello,

It's likely simply a matter of ensuring the domain name exists in /etc/remotedomains so the email server does not attempt to route the email locally. To ensure this setting is preserved, simply choose "Remote Mail Exchanger" under "Email Routing" when editing the domain name's DNS zone via "WHM >> Edit DNS Zone".

Also, keep in mind that GoDaddy is already relaying your email through a relay server.

Thank you.