Re: [exim] Simple filter to copy a single users incoming and…

Top Page
Delete this message
Reply to this message
Author: Ted Cooper
Date:  
To: exim-users
Subject: Re: [exim] Simple filter to copy a single users incoming and outgoing mail?
Rob wrote:
> I have the unfortunate task of setting up a filter to monitor a single
> users incoming and outgoing mail. If it were just incoming mail I
> would use the system aliases to deliver a copy to another account, but
> I need to get the outgoing mail as well. I am thinking that a system
> filter might be the right way to go about this, such as:


I think a system filter is the way to go here. I have something similar setup
on a server to keep an archive of all emails for a domain to do local spam
training. I've based mine on the headers, but using $sender_address and
$recipients _should_ work, but I'm not going to look it up.

At the top of the configure file:
system_filter = /etc/exim/exim.filter
system_filter_user = exim
system_filter_group = exim

The exim.filter file (chown'd exim.exim, chmod 0500).

# Exim filter

# don't want to get multiple copies
if first_delivery
and ("$h_to:, $h_cc:" contains "user@???")
or ("$h_from:" contains "user@???")
then
unseen deliver "store@???"
endif

Of course, BCC's don't get caught by this so there's a good reason to use the
system variables rather than the headers.
Also, this is comepletely illigal in Australia unless you get their written
concent, so check your local privacy laws.

Ted.