How to forward all outgoing emails from a domain

If we need to forward all outgoing emails from a particular domain to an email address, follow the steps given below.

Step1: Open the file '/etc/cpanel_exim_system_filter'

#vi /etc/cpanel_exim_system_filter

Step2: Append the below lines to the file

if $h_from: contains "domain1.com"
then
unseen deliver "monitor@domain2.com"
endif

Here we need to replace domain1.com with the actual domain and monitor@domain2.com with the email address to which you want to forward the mails.

Step3: Save the file and close it

Step4: Restart exim service

#/etc/init.d/exim restart

That's all....

 

Leave a Reply

Your email address will not be published. Required fields are marked *