Issue :
How can emails going out from a particular domain be copied to a common email address ?
Solution :
In order to set up a forwarder for outgoing emails from a particular domain to another email address, use the following steps :
First, open the file /etc/cpanel_exim_system_filter using any of your favorite editors.
Add the following content to it :
if (
$received_protocol is “local” or
$received_protocol is “esmtpa” or
$received_protocol is “smtp”
) and (
$header_from contains “@domainname.com” )
then
unseen deliver [email protected]
endif
Now, if you DO NOT want to forward outgoing emails from a particular email address on that domain, you can add the following code in the /etc/cpanel_exim_system_filter file :
if (
$received_protocol is “local” or
$received_protocol is “esmtpa” or
$received_protocol is “smtp”
) and (
$sender_address is not ” [email protected]
and (
$header_from contains “@domainname.com” )
then
unseen deliver [email protected]
endif
Finally, you should replace the values of the variables used in the above codes.
domainname.com – the actual domain
[email protected] – email address to which you want to forward.
[email protected] – email address that you don’t want to forward
Save and exit the file.
Restart Exim using any of the the following commands :
/scripts/restartsrv_exim or
/etc/init.d/exim restart or
service exim restart