Different smart host for sending emails

Azim

Well-Known Member
Oct 16, 2015
67
0
6
India
cPanel Access Level
Website Owner
Hello All,

Hope everyone is doing good. With the help of below URL and your support , I managed to send emails of my different domains via different SMTP providers. So currently I have two SMTP relay where first domain send emails from Google smtp and second domain sends emails from Mailgun.

However Is this possible to send emails from a particular smtp relay to a particular recipients. So lets say,

1. My first domain using Google smtp relay.
2. There is a automatic email schedule via script.
3. It sends a single copy to [email protected] , [email protected] and [email protected]
4. Since I have already configured a second smtp relay called mailgun.

So If my first domain sends an email using Google smtp and when it sends the automatic emails, then it should take mailgun smtp relay to send email to [email protected].

Please let me know if you need more details on this and please help me to implement this.

My current Exim config is below,

Code:
@[email protected]:

smarthost_dkim:

  driver = manualroute

  domains = !"+local_domains +smart_hosts"

  condition = "${if eq{${lookup{$sender_address_domain}partial-lsearch{/etc/staticroutes}{$value}}}{}{false}{true}}"

  ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 : 64.94.110.0/24

  headers_add = "${perl{mailtrapheaders}}"

  require_files = "+/var/cpanel/domain_keys/private/${sender_address_domain}"

  transport = remote_smtp_smart_dkim

  route_list = !+local_domains "${lookup{$sender_address_domain}partial-lsearch{/etc/staticroutes}}"



smarthost_regular:

  driver = manualroute

  domains = !"+local_domains +smart_hosts"

  condition = "${if eq{${lookup{$sender_address_domain}partial-lsearch{/etc/staticroutes}{$value}}}{}{false}{true}}"

  ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 : 64.94.110.0/24

  headers_add = "${perl{mailtrapheaders}}"

  transport = remote_smtp_smart_regular

  route_list = !+local_domains "${lookup{$sender_address_domain}partial-lsearch{/etc/staticroutes}}"

@[email protected]:


remote_smtp_smart_dkim:

  driver = smtp

  hosts_require_tls = *

  interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch*{/etc/mailips}{$value}{}}}{}}

  helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch*{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_hostname}}

dkim_domain = $sender_address_domain

dkim_selector = default

dkim_private_key = "/var/cpanel/domain_keys/private/${dkim_domain}"

dkim_canon = relaxed


remote_smtp_smart_regular:

  driver = smtp

  hosts_require_tls = *

  interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch*{/etc/mailips}{$value}{}}}{}}

  helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch*{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_hostname}}
Sorry I did not paste the URL,


Forward certain domain emails to Smart Host
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,227
463