Some times you need to make custom modifications to the Exim filters. You finally get everything working correctly, just the way you like it. Then there is an update, and you notice your custom changes are no longer present.
To prevent your custom Exim filters from being overwritten during updates, you will want to create a custom Exim system filter file or custom filter rule files to be included in the Exim configuration.
How to create a custom filter rule file
To create a custom filter rule file, perform the following steps:
- Create a file in the /usr/local/cpanel/etc/exim/sysfilter/options/ directory.
- Within that file, enter your custom filter rules.
- Navigate to WHM’s Exim Configuration Manager interface (WHM >> Home >> Service Configuration >> Exim Configuration Manager). In the Basic Editor section, select the Filters tab.
- Disable any undesired filter rules.
- Click Save.
Warning: The Exim configuration enables all of the custom filter rules within the /usr/local/cpanel/etc/exim/sysfilter/options/ directory.
How to create a custom Exim system filter file
Warning: Do not directly edit the /etc/cpanel_exim_system_filter file. The system will lose any changes when your Exim Configuration rebuilds.
To create a custom system filter file, perform the following steps:
- Log in to the server as the root user.
- Run the following command to copy the /etc/cpanel_exim_system_filter file: cp -p /etc/cpanel_exim_system_filter /etc/cpanel_system_filter_new
- Confirm that the new file has the following ownership and file permissions: -rw-r--r-- 1 root root
- Use your preferred text editor to edit the /etc/cpanel_system_filter_new file.
- Navigate to the Basic Editor section of WHM’s Exim Configuration Manager interface (WHM >> Home >> Service Configuration >> Exim Configuration Manager).
- Select the textbox option for the System Filter File setting. (Warning: 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.)
- Enter the new file’s absolute path in the text box (for example, /etc/cpanel_system_filter_new).
- Click Save. (Note: Exim restarts when you save changes in the Exim Configuration Manager interface.)
For further information on customizing your Exim system filter, please review our documentation page: https://docs.cpanel.net/knowledge-base/email/how-to-customize-the-exim-system-filter-file/