The following provides an example of how you can use an Exim system filter in cPanel to forward all outbound mail for an email account.
Filters and forwarders that can be managed directly within a cPanel account are only applied to incoming messages, so this method is useful if you need to affect outbound messages.
Please keep in mind that cPanel is not able to provide support for customizing the specific contents of your Exim filters. If you need help crafting a custom filter, you should reach out to a systems administrator with the skills, training, and expertise required to do so for you.
1. Login to the server via SSH or Terminal as the root user
2. Create a filter file with the touch command:
3. Customize the following example filter and put it into the file that you just created:
if ("$h_from:" contains "email@example.com")
## The following will make it so that the original recipient is skipped and
## and only firstname.lastname@example.org will recieve the message
## If you add the word unseen in front, the message will be forwarded to
## email@example.com as well as delivered to the original recipient.
## For example, you would remove the above deliver line and replace it with:
## unseen deliver "firstname.lastname@example.org"
4. Rebuild the exim configuration with the following command:
As long as the filter file is enabled (it is by default when you first create it) cPanel will copy your custom filter in to the system filter file at: /etc/cpanel_exim_system_filter
5. Restart Exim with the following command:
To disable or enable your custom filter use the following steps:
1. Login to WHM as the root user
2. Navigate to: Home »Service Configuration »Exim Configuration Manager
3. Click on the Filters tab
4. Look for your filter prefaced by "Custom Filter"
5. Enable or disable it
6. Click the blue Save button