External SMTP server only for specific users

saderi

Registered
Aug 24, 2019
1
0
1
Turkey
cPanel Access Level
Root Administrator
Hi Everyone,

I am using external SMTP server on Exim. like SMTP2Go or mailjet.
Now all of WHM users using that.
Is there any way to specify only some of them can use it and the others only can use normal Exim ?
 

cPanelLauren

Forums Analyst II
Staff member
Nov 14, 2017
7,508
591
263
Houston
cPanel Access Level
DataCenter Provider
Hello,


This is detailed in smtp2go's setup instructions https://www.smtp2go.com/setupguide/exim_whm_cpanel/

(i) Specify only certain domains (of the sender email address) to send through the smarthost

Create a text file to include the domains that should use SMTP2GO. For example, create a file /etc/exim/authorized_senders.txt. Add domain names in below format into that file:

domain1.com: mail.smtp2go.com
domain2.com: mail.smtp2go.com


At the ROUTERSTART section, change the router_data line as below:

route_data = ${lookup{$sender_address_domain}lsearch*{/etc/exim/authorized_senders.txt}}

Restart the Exim service.

(ii) Exclude certain domains (of the sender email address) from sending through the smarthost

Create a text file to exclude the domains from sending through the SMTP2GO. For example, create a file /etc/exim/excludesenderdomains.txt. Add domain names in below format into that file:

domain1.com:
domain2.com:


Add the following line in the MAIN CONFIGURATION section:

domainlist exclude_sender_domains = lsearch;/etc/exim/excludesenderdomains.txt

Add the following line in the ROUTERSTART section after the ‘domains = ! +local_domains‘ line:

senders = !*@+exclude_sender_domains

Restart the Exim service.