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

Filed Under: Articles and tutorialsTechnical

Tags:

About the Author: InstaCarma is a provider of Enterprise Class Solutions for the Hosting Industry

RSSComments (0)

Trackback URL

Leave a Reply

Get Adobe Flash playerPlugin by wpburn.com wordpress themes
InstaCarma provides outsourced web hosting technical support, helpdesk management, datacenter automation, cloud service management. Sales - 1800 810 6547 - visit www.instacarma.com