Knowledge Base

How Can We Help?

Customize Exim System Filter File

You are here:

There is also a mechanism for checking messages once they have been received, but before they are delivered. This is called the system filter. The Exim system filter file scans messages that your server has received, but that it has not yet delivered. cPanel allows you to easily create custom Exim filters by simply dropping the rules in /usr/local/cpanel/etc/exim/sysfilter/options/ .

 

Creating Custom Filter Rule File

1) Create a file in the /usr/local/cpanel/etc/exim/sysfilter/options/ directory.

2) Enter your custom filter rules within this file.

For example, to block mail from [email protected], add the following rule:

if (“$h_from:” contains “[email protected]”)

then fail

endif

3) Go to WHM >> Home >> Service Configuration >> Exim Configuration Manager). In the “Basic Editor” section, select the “Filters” tab.

Exim Filter

4) Here you can disable any undesired filter rules.

5) Click the “Save” button.

The Exim configuration enables all of the custom filter rules within the /usr/local/cpanel/etc/exim/sysfilter/options/ directory.

 

Create Custom Exim System Filter File.

Perform the following steps to create a custom system filter file.

1)Log in to the server as the root user.

2) Run the following command to take a backup of the /etc/cpanel_exim_system_filter file:

cp -p /etc/cpanel_exim_system_filter  /etc/cpanel_system_filter_new1

We strongly recommend that you copy this file before you edit it, if anything wrong happens we can easily restore the Exim configuration with those backups.

3) Make sure that the new file has the following ownership and file permissions:

-rw-r–r– 1 root root

4) Use a text editor to edit the /etc/cpanel_system_filter_new1 file.

5) Go to WHM >> Home >> Service Configuration >> Exim Configuration Manager

6) In the “Basic Editor” section of the interface, select the “textbox” option for the System Filter File setting.

Note: Regardless of which option you select, the Exim configuration will include all of the files within the /usr/local/cpanel/etc/exim/sysfilter/options/ directory.

7) Enter the new file’s absolute path in the text box (for example, /etc/cpanel_system_filter_new1).

8) Click “Save” button.

Leave a Comment