Introduction
Filters and forwarders that can be managed directly within a cPanel account are only applied to incoming messages. They do not affect outbound messages. To forward outbound messages, you need to create a system filter. This article provides an example of how you can use an Exim system filter in cPanel to forward all outbound mail from an email account.
Please note 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.
Procedure
- Access the server's command line as the 'root' user via SSH or "Terminal" in WHM.
- Create the filter file.
touch /usr/local/cpanel/etc/exim/sysfilter/options/fowardOutbound.conf
- Open the newly created filter file in your preferred text editor.
- Add the following to the file.
if ("$h_from:" contains "from@domain.tld")
Please note that 'from@domain.tld' and 'recipient@domain.tld' must be replaced with the sender and recipient email addresses, respectively.
then
## The following will make it so that the original recipient is skipped and
## and only recipient@domain.tld will recieve the message
deliver "recipient@domain.tld"
## If you add the word unseen in front, the message will be forwarded to
## recipient@domain.tld as well as delivered to the original recipient.
## For example, you would remove the above deliver line and replace it with:
## unseen deliver "recipient@domain.tld"
endif - Rebuild the Exim configuration.
/scripts/buildeximconf
Please note that cPanel will copy your custom filter into the system filter file. By default, this is at "/etc/cpanel_exim_system_filter" but may be different depending on your customization of the "System Filter File" setting in the Exim Basic Configuration. - Restart Exim.
/scripts/restartsrv_exim
Comments
0 comments
Article is closed for comments.