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!

Route all *BUT* dedicated IP addresses through smarthost

Discussion in 'E-mail Discussion' started by justjaph, Oct 17, 2013.

  1. justjaph

    justjaph Member

    Joined:
    Oct 17, 2013
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi all.

    I need to route all outbound email through a smart host but not the email that comes from the clients/resellers that have dedicate IP addresses.

    Using a suggestion found somewhere else, this is what I got:

    Scenario: Server has 3 IP addresses - 192.168.1.1 is the shared one, 192.168.1.2 and 192.168.1.3 are dedicated to clients. Relay is myrelay.domain.dom.

    (note: "fictional" IP addresses. The server has -of course- public and routeable IP addresses).

    First approach: All from 192.168.1.1 and from "nothing" (local generated emails by scripts, for instance):

    Section: TRANSPORTSTART

    remote_smtp_smart_regular:
    driver = smtp
    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}}

    Section: ROUTERSTART

    smarthost_regular:
    driver = manualroute
    domains = !+local_domains
    transport = remote_smtp_smart_regular
    route_list = $domain myrelay.domain.dom
    condition = ${if or { {match_ip{$received_ip_address}{192.168.1.1}} {eq{$received_ip_address}{}} }}

    Second approach: everything but dedicated IP addresses:

    Section: TRANSPORTSTART

    remote_smtp_smart_regular:
    driver = smtp
    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}}

    Section: ROUTERSTART

    smarthost_regular:
    driver = manualroute
    domains = !+local_domains
    transport = remote_smtp_smart_regular
    route_list = $domain myrelay.domain.dom
    condition = ${if !match_ip{$received_ip_address}{192.168.1.2,192.168.1.3}}

    Both attempts failed miserably, as email coming from the dedicated IP addresses is being routed to the relay ...

    Can anyone spot what am I doing wrong here ?

    Regards,

    ./J
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,822
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice