The Exim system filter file scans messages that your server has received, but that it has not yet delivered. There are 2 ways to add custom filter rules:
1) Through Mail Settings
2) Through custom filter file
How to set custom filter rules through admin panel
Go to Admin Panel >> Email >> Mail Settings. Find the Filters tab under Basic Editor. There is Custom Filters option there. You can add custom filter rules in the text box.
![image image](https://webuzo.com/sitepad-data/uploads/2024/07/image-17.png)
How to set custom filter rules through filter file
Create a file named "customfilter" in /var/webuzo/conf/exim/. You can add the custom filter rules in the file. After adding the rules, execute the command webuzo --exim_rebuild_conf from the terminal as the root user.
Sample custom filter rule
Below is an example of custom filter rule which blocks mails from user@example.com.
if ("$h_from:" contains "user@example.com")
then fail
endif
Note: If custom filter rules are set by both the methods, the one set in the Mail Settings will be given first preference.