Smart Host to Selected Domains

tufancap

Member
Jun 5, 2020
14
1
3
sweden
cPanel Access Level
Root Administrator
Hello to everyone
There are many topics about this topic.
I read all topics
but a little difficult for novice or intermediate users like me
now I'll tell you what I want

I have 14 domains in cpanel
there are 3 e-commerce sites in them and they have heavy e-mail traffic.
I want to use a smart host for only 3 domains. I don't want to use it for all domains.
I think this is possible, but I did not understand it well.

1-
works with these settings
but for all domains

@[email protected]
company_login:
driver = plaintext
public_name = LOGIN
client_send = : MY-USERNAME : MY-PASS

@[email protected]

send_via_company:
driver = manualroute
domains = ! +local_domains
transport = company_smtp
route_list = * company.mail.com
@[email protected]
company_smtp:
driver = smtp
port = 25
hosts = company.mail.com
hosts_require_auth = company.mail.com

2-
Turn off the smart host feature and
when you make these settings
send smart host from only one email address you added
but the email is waiting in a queue for a bit, but then it goes.
but you can send it from a single email address. I could not add a second or third email address.
other emails go normally. The email I added is sent via the smart host.


@[email protected]
company_login:
driver = plaintext
public_name = LOGIN
client_send = : MY-USERNAME : MY-PASS
@[email protected]
send_via_company:
driver = manualroute
domains = ! +local_domains
senders = [email protected] (that's the only difference)
transport = company_smtp
route_list = * company.mail.com
@[email protected]
company_smtp:
driver = smtp
port = 25
hosts = company.mail.com
hosts_require_auth = company.mail.com


How should I organize this scenario?
only the domains I want can send as smart hosts.
there are topics related to this in the forum but experienced user level information. I would appreciate it if you could help with a simpler expression.

Best regards
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
14,322
2,242
363
cPanel Access Level
Root Administrator
Hey there! I don't believe there is going to be an easier method than the things that have already been posted on the forum in the past. cPanel doesn't natively support this type of mail handling, so any work to get this configuration applied will involve advanced editing of the Exim configuration and router systems.
 

tufancap

Member
Jun 5, 2020
14
1
3
sweden
cPanel Access Level
Root Administrator
I have read all of these topics. There is no answer I'm looking for.



for example
here you can send emails from 1 domain with smart host.
I wish we could add domains with commas here.
Section: PREROUTERS
send_via_dmail:
driver = manualroute
domains = ! +local_domains
condition = "${if eq {$sender_address_domain}{mydomain.com}{true}{false}}"
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
headers_add = "${perl{mailtrapheaders}}"
transport = dmail_smtp
route_list = * outbound.dmail.com
{mydomain.com, domain2.com, domain3.}

For example, is something like this possible?
comma doesnt work, tried it.
Is there a command that works?
 

tufancap

Member
Jun 5, 2020
14
1
3
sweden
cPanel Access Level
Root Administrator
Solution
Specify only certain domains (of the sender email address) to send through the smarthost
Easy Settings
Replace the underlined text with your own settings

Exim Configuration Manager + Advanced editor
@[email protected]
company_login:
driver = plaintext
public_name = LOGIN
client_send = : MY-USERNAME : MY-PASS
@[email protected]
send_via_company:
driver = manualroute
domains = ! +local_domains
transport = company_smtp
route_data = ${lookup{$sender_address_domain}lsearch*{/etc/exim/authorized_senders.txt}}
@[email protected]
company_smtp:
driver = smtp
port = 25
hosts = company.mail.com
hosts_require_auth = company.mail.com

create a file /etc/exim/authorized_senders.txt. Add domain names in below format into that file:

domain1.com: company.mail.com
domain2.com
: company.mail.com

Exim Restart

If you still don't understand, write it here. I will try to help.

source text

Thanks cPRex for encouraging me to do further research.
 
  • Like
Reactions: cPRex