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!

Accept remote mails only from trusted IP domain-wise

Discussion in 'E-mail Discussion' started by ipole, Dec 3, 2013.

  1. ipole

    ipole Member

    Joined:
    Jun 16, 2004
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    151
    I have an external spam filter server, and want some of my domains on Cpanel to accept mails which have originated only from the spam filter server. This is to avoid spammers who directly deliver to the mail server, instead of the MX.

    However, the same Cpanel server hosts other unprotected domains for whom the mail deliveries should work directly. At the same time, in case another domain on this server mails to the protected domain (local deliveries), they should be permitted.

    I am no expert at Exim, but was trying to write a smarthost filter which will check the sender_host_name if it doesn't match with my external spam filter server, and a couple of other conditions, then it would handover the mail to the spam filter server. The spam filter server would then send it back to the Cpanel server in case the mail was clean. I am pasting the condition below, but it seems to be going wrong somewhere and directing all mails to the spam filter server.

    Code:
    smarthost_protecteddomains:
       condition = "${if and { \
    		{!eq {${lc:$sender_host_name}} {myspamfilter.tld}} \
    		{!eq {$received_protocol}{local}} \
    		{eq {${domain}} {protecteddomain.tld}} \
    	} {true}{fail}}"
       driver = manualroute
       transport = remote_smtp
       domains = ! +local_domains
       route_list = "* 204.12.250.154"
    
    Does anybody find a flaw in this? Is there any better method to handle this situation?
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

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

    ipole Member

    Joined:
    Jun 16, 2004
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    151
    Thanks for your response, Michael. I went through the URL referred by you. My requirement is a bit different.

    The primary objective is that certain domains on the shared server must accept inbound mails originating only from my spamfilter server. It should not accept direct connections for inbound mail from the world. At the same time, mails from authenticated users who use the exim SMTP should be treated as normal and delivered locally, irrespective of the above rule.

    Is there any way of achieving this in Exim?
     
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