Setting Forwarder For Outgoing Email For a Domain

To set a forwarder for all outgoing emails  from a particular domain to an email address, follow the steps given below.

Note:- This is only tested on cPanel11 Server.

1. Take the file /etc/cpanel_exim_system_filter in any of your favorite editor like pico, vim etc
2. Append the following contents to the file /etc/cpanel_exim_system_filter.

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

If you don’t want to forward emails from a  particular email address, you can append the following snippet in the /etc/cpanel_exim_system_filter.

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

3. Replace the following

domainname.com with the actual domain
username_escape@domainname.com with email address that you don’t want to forward
username@domainname.com with the email address to which you want to forward.

4. Save the file and then quit.
5. Restart Exim using the following command.

/scripts/restartsrv_exim or
/etc/init.d/exim restart

6. Test it by sending any email from the domain and then check the logs.

 

Both comments and pings are currently closed.

Comments are closed.