How to block one email user from sending to certain domains?
I have several domains on my WHM/cPanel server. These domains have several users (e.g. email addresses).
I would like to block that from one MY email account cannot be send email to certain domains.
Example:
user1@mydomain.si " can send email to everybody
user2@mydomain.si " can NOT send email to @gmail.com, @hotmail.com, @web.de but can send email to ALL other domains.
I hope you understand my concern.
Thank you for your help.
Best regards,
Bostjan
-
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 -
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 -
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 -
If I need to add @hotmail.com, @web.de, do I just copy that if statement and replace domain? 0 -
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 -
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 -
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 -
- 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 directory0 -
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 -
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/mailinator0 -
The striked out is an email. 0 -
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 -
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 -
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.
Comments
14 comments