Skip to main content

How to block one email user from sending to certain domains?

Comments

14 comments

  • cPanelLauren
    Hello, To do this you'd need to set up a custom Exim system filter rule. Documentation on how to use the Exim system filter can be found here: How to Customize the Exim System Filter File - cPanel Knowledge Base - cPanel Documentation Thank you,
    0
  • bcadej
    I don't want to mess up stuff. I'm not experienced script user. That example shows hot to block receiving mail from user@example.com. What to write to meet my needs. Block mail TO certain domains FROM one local user " email?
    0
  • cPanelLauren
    Hello, I created a test filter using the instructions provided in the link which blocks email from my email user to gmail as an example: # cat /usr/local/cpanel/etc/exim/sysfilter/options/test if("$h_to:, $h_cc:, $h_bcc:" contains "gmail.com") and ("$header_from:" contains "myuser@mydomain.com") then fail endif
    Thank you,
    0
  • bcadej
    If I need to add @hotmail.com, @web.de, do I just copy that if statement and replace domain?
    0
  • cPanelLauren
    Hello, I would suggest creating one for each domain/user and naming them accordingly. That way if you run into an issue with one of them or you need to remove one it will be easier to disable/modify.
    0
  • bcadej
    It doesn"t work. WHM >> Home >> Service Configuration >> Exim Configuration Manager. In the Basic Editor section, the Filters tab >> Custom Filter: mailinator There is a yellow exclamation mark >> The setting, filter_mailinator, was not set in the configuration file, so the default has been used. Where/how to I set this in the configuration file?
    0
  • cPanelLauren
    Hello, Can you show me the permissions and rules within your filter file? stat /usr/local/cpanel/etc/exim/sysfilter/options/filter_mailinator
    cat /usr/local/cpanel/etc/exim/sysfilter/options/filter_mailinator
    Thank you,
    0
  • bcadej
    - Removed - [root@vps ~]# stat /usr/local/cpanel/etc/exim/sysfilter/options/filter_mailinator stat: cannot stat "/usr/local/cpanel/etc/exim/sysfilter/options/filter_mailinator": No such file or directory
    [root@vps ~]# cat /usr/local/cpanel/etc/exim/sysfilter/options/filter_mailinator cat: /usr/local/cpanel/etc/exim/sysfilter/options/filter_mailinator: No such file or directory
    0
  • cPanelLauren
    Hello, Did you create the file as indicated by the documentation? Based on this it doesn't appear to exist. The steps are: [QUOTE]
    • Create a file in the /usr/local/cpanel/etc/exim/sysfilter/options/ directory.
    • Within that file, enter your custom filter rules. For example, to block mail from user@example.com, add the following rule: if ("$h_from:" contains "user@example.com") then fail endif
    • Navigate to WHM's
    0
  • cPanelLauren
    Hello, If the filter is just mailinator then the commands to view it should be: stat /usr/local/cpanel/etc/exim/sysfilter/options/mailinator
    cat /usr/local/cpanel/etc/exim/sysfilter/options/mailinator
    0
  • bcadej
    The striked out is an email.
    0
  • cPanelLauren
    Hi @bcadej The bottom of that appears to be cutoff is the final line in that file "endif"? Can you also run /scripts/buildeximconf and let me know if the issue persists? Thank you,
    0
  • bcadej
    I've found the problem. How to Customize the Exim System Filter File - cPanel Knowledge Base - cPanel Documentation How to create a custom filter rule file Number 4 says "Disable any undesired filter rules." In WHM in Filter tab: the new line stated "Custom Filter: mailinator" in the right column "on" was selected and under on default is written. So the number 4 says "Disable any undesired filter rules." " I didn"t need to disable any rules so I didn"t do anything. Also not number 5, which is "Click Save." Now I've clicked Save. Now it works. Thank you.
    0
  • cPanelLauren
    Hi @bcadej Thank you, for updating the results, I'm glad you were able to get it working for you. Thank you,
    0

Please sign in to leave a comment.