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 forward@gmail.com; change the domain name (domain.com) and mail id (forward@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 forward@gmail.com
endif
Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: