Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Exim conf for forcing smarthost even for local delivery

Discussion in 'E-mail Discussions' started by unco, Dec 29, 2016.

Tags:
  1. unco

    unco Member

    Joined:
    Jun 17, 2010
    Messages:
    7
    Likes Received:
    1
    Trophy Points:
    53
    Location:
    Southern Pines, NC
    Hello everyone,

    With the help of a few forum threads, I've configured exim to send mail for a few domains out through a smarthost (for encrypted outbound mail for HIPAA). These folks want to send each other encrypted messages as well, so I'm looking for the proper config to force those messages out through the smarthost and not delivery them locally.

    Here's my existing exim.conf.local, which works for sending outbound to domains not on the same server. The IP address mentioned here is a fake one I've replaced the actual IP with.

    To recap, my question is, how do I force all email to go out through the smarthost, even when it's for local delivery?

    Many thanks in advance!
    Beth

    Code:
    @AUTH@
    
    @BEGINACL@
    
    @CONFIG@
    daemon_smtp_ports = 465 : 587 : 25
    hostlist smart_hosts = lsearch;/etc/smarthosts
    
    @DIRECTOREND@
    
    @DIRECTORMIDDLE@
    
    @DIRECTORSTART@
    
    @ENDACL@
    
    @POSTMAILCOUNT@
    
    @PREDOTFORWARD@
    
    @PREFILTER@
    
    @PRELOCALUSER@
    
    @PRENOALIASDISCARD@
    
    @PREROUTERS@
    
    @PREVALIASNOSTAR@
    
    @PREVALIASSTAR@
    
    @PREVIRTUALUSER@
    
    @RETRYEND@
    
    @RETRYSTART@
    
    @REWRITE@
    
    @ROUTEREND@
    
    @ROUTERMIDDLE@
    
    @ROUTERSTART@
    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 : 111.222.333.111
      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}}"
    #  route_list = * "${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 : 111.222.333.111
      headers_add = "${perl{mailtrapheaders}}"
      transport = remote_smtp_smart_regular
      route_list = !+local_domains "${lookup{$sender_address_domain}partial-lsearch{/etc/staticroutes}}"
    #  route_list = * "${lookup{$sender_address_domain}partial-lsearch{/etc/staticroutes}}"
    
    @TRANSPORTEND@
    
    @TRANSPORTMIDDLE@
    
    @TRANSPORTSTART@
    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}}
    
     
  2. unco

    unco Member

    Joined:
    Jun 17, 2010
    Messages:
    7
    Likes Received:
    1
    Trophy Points:
    53
    Location:
    Southern Pines, NC
    Oh, geez. I think I just saw the potential issue when I hit "post." This is probably the line I need to remove:

    ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 : 111.222.333.111

    Sound right?

    Beth
     
  3. unco

    unco Member

    Joined:
    Jun 17, 2010
    Messages:
    7
    Likes Received:
    1
    Trophy Points:
    53
    Location:
    Southern Pines, NC
    Well, I'm replying to say that commenting out the ignore didn't give the anticipated results. I'm open for suggestions!

    Thanks,
    Beth
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page