How to set up a forwarder for outgoing emails?

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 username@domainname.com
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 ” username_escape@domainname.com
and (
$header_from contains “@domainname.com” )
then
unseen deliver username@domainname.com
endif
Finally, you should replace the values of the variables used in the above codes.
domainname.com – the actual domain
username@domainname.com – email address to which you want to forward.
username_escape@domainname.com – 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

Source : InstaCarma

 


Comments

Popular posts from this blog

DevOps Basics You Should Know Before Adopting Services

Poodle – SSL Security Threat Explored

cPanel Updates – November 2014