Spam Experts Help

cPanel/WHM IP-based Authentication (selected domains)

This method allows you to filter selected domains via our Outgoing filter, while using IP authentication. Any domains not configured here will continue to use the standard cPanel router and transport.

  1. Ensure the IP address is added as an authorized smarthost (without authentication).
  2. Ensure the outgoing user has correct limits set matching your traffic volumes.
  3. SSH to the cPanel/WHM node.
  4. Create the file /etc/spamexperts_domains.
  5. Add the domains that you wish to filter outbound in that file (one per line).
  6. Save the file.
  7. Navigate to Exim Configuration Editor in WHM.
  8. Choose Advanced Editor.
  9. Add the following in "Section: POSTMAILCOUNT" (replace SMARTHOST with the correct SMTP hostname):
  10. smarthost_dkim:
      driver = manualroute
      domains = !+local_domains
      condition = ${if match_domain{$sender_address_domain}{lsearch;/etc/spamexperts_domains}}
    require_files = "+/var/cpanel/domain_keys/private/${sender_address_domain}"
      # Exclude null sender messages from relaying via the smarthost
      condition = ${if or {{!eq{$sender_address}{}} {!eq{$sender_host_address}{}}}}
      transport = remote_smtp_smart_dkim
      route_list = $domain SMARTHOST::587
     
    smarthost_regular:
      driver = manualroute
      domains = !+local_domains
      condition = ${if match_domain{$sender_address_domain}{lsearch;/etc/spamexperts_domains}}
      # Exclude null sender messages from relaying via the smarthost
      condition = ${if or {{!eq{$sender_address}{}} {!eq{$sender_host_address}{}}}}
      transport = remote_smtp_smart_regular
      route_list = $domain SMARTHOST::587

  11. Add the following in "Section: TRANSPORTSTART" :
  12. 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
    headers_add = "${perl{check_mail_permissions_headers}}"
     
    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}}
    headers_add = "${perl{check_mail_permissions_headers}}"

  13. Save and restart.
  14. All traffic from the cPanel/WHM server will be routed to the Spam Experts filtering nodes.