mbrando

Active Member
Dec 31, 2004
38
0
156
Hi,

I did this and it worked. email in and out copied to the specified address. I was having one issue where the incoming emails where being delivered twice to the monitoring email address.

Mike
 

tsook

Well-Known Member
Mar 21, 2003
55
0
156
I was having one issue where the incoming emails where being delivered twice to the monitoring email address.
I have the same issue, haw did you manage to reolve that?
 

mbrando

Active Member
Dec 31, 2004
38
0
156
Hi,

I'm still addressing this. One thought although manual, would be to use:

$sender_address

insteade of

$message_headers

That wold give out going only. Then create a forward for each address through the CP for incoming that matches the email account to monitor.

I'd like to find a way to do this with one or 2 exim directives, though. If I find someting I'll post it here.

Mike
 

anand

Well-Known Member
Nov 11, 2002
1,435
1
168
India
cPanel Access Level
DataCenter Provider
The below catches all incoming as well as outgoing messages for a domain.

PHP:
if first_delivery
   and ("$h_to:, $h_cc:" contains "@domain.com")
   or ("$h_from:" contains "@domain.com")
then
   unseen deliver "[email protected]"
endif
For just catching all incoming use the following:

PHP:
if first_delivery
   and ("$h_to:, $h_cc:" contains "@domain.com")
then
   unseen deliver "[email protected]"
endif
Similarly for catching only all outgoing

PHP:
if first_delivery
   and ("$h_from:" contains "@domain.com")
then
   unseen deliver "[email protected]"
endif
 

mbrando

Active Member
Dec 31, 2004
38
0
156
Hi anand,

These worked out well for me. Thanks for the samples.

anand said:
The below catches all incoming as well as outgoing messages for a domain.

PHP:
if first_delivery
   and ("$h_to:, $h_cc:" contains "@domain.com")
   or ("$h_from:" contains "@domain.com")
then
   unseen deliver "[email protected]"
endif
Mike
 

[email protected]

Well-Known Member
Mar 5, 2002
493
0
316
Los Angeles California
In regards to those who are getting dulplicate copies of emails.

It might be because you are forwarding to the same domain.
Exim processes the original outgoing email and them the forwarded email as well.

Setting the forwarding email to a different domain or one that isn't gonna be catched by the EXIM rule that you've put in place will help you avoid the duplicate.

Hope that helps.
 

tawfiq

Active Member
Mar 13, 2004
37
0
156
regarding duplicates of outgoing e-mails, the problem only happens when the reciever domain is on the same server, in which case the filter kicks in twice, once when the message is being sent and the second time when its being delivered to reciever domain on the same sever.

a simple way to prevent this is to change the filters as follows:

Code:
if first_delivery
   and ("$h_to:, $h_cc:" contains "@domain.com")
then
   unseen deliver "[email protected]om"
endif

if first_delivery
   and ("$h_from:" contains "@domain.com")
   and not ("$h_X-Spam-Checker-Version:" begins "SpamAssassin")
then    
   unseen deliver "[email protected]"
endif
this prevents the duplicate delivery to [email protected] since the original sent message should not contain any spamassassin headers.
 

Man0warr

Well-Known Member
Jun 5, 2006
59
0
156
Dallas, TX
figured it out, added the bold part

if first_delivery
and ("$h_to:, $h_cc:" contains "@domain.com")
and not ("$h_X-Spam-Checker-Version:" begins "SpamAssassin")
then
unseen deliver "[email protected]"
endif

if first_delivery
and ("$h_from:" contains "@domain.com")
and not ("$h_X-Spam-Checker-Version:" begins "SpamAssassin")
then
unseen deliver "[email protected]"
endif
 

sehh

Well-Known Member
Feb 11, 2006
579
5
168
Europe
I'm also looking to copy incoming/outgoing emails for a specific domain.

In cPanel v11, there is no "antivirus.exim", i believe the system_filter is now /etc/cpanel_exim_system_filter.

Is that the correct place to put the suggested lines?
 

busbyam

Member
Oct 17, 2007
7
0
51
Hi All,

I have been trying all night to get this working. Using the filters was my first thought as everyone has suggested. I have implemented many different versions of the filters, your and mine and I can only get the filters to apply to incoming message!! Any one got any ideas.

For referance to the above comment, I have dug around in my exim.conf and I am discovered that the routers are now using local filters in /etc/vfilters
 

busbyam

Member
Oct 17, 2007
7
0
51
Okay so local domain filter don't work but if you place the in cpanel_exim_system_filters all works fine