Friday, March 8, 2013

Forwarding all mails from a domain to a Specific Email ID


You can use the code below to forward all mails from a domain to a specific email ID, it will work for newly created mail accounts automatically.

Add the code below at the end of "/etc/system_filter.exim"

Here, all the mails from domain.com are forwarded to test@gmail.com; change the domain name (domain.com) and mail id (test@gmail.com) as per the requirement.

============
if ( foranyaddress $reply_address,$return_path,$sender_address,$header_from,$h_from,$h_to:,$h_cc:,$h_bcc:,$recipients
( $thisaddress contains @domain.com )) and ( $header_X-Ref-Type does not contain yes )
then
headers add "X-Ref-Type: yes\n"
unseen deliver test@gmail.com
endif
==============

No comments:

Post a Comment