Re: [Exim] partial-lsearch as filter conditional

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: Marc Perkel
CC: exim-users
Subject: Re: [Exim] partial-lsearch as filter conditional
On Thu, 13 Dec 2001, Marc Perkel wrote:

> ok - here's what I want to do.
>
> All the users will have the ability to put a file in their own home
> directory called .spam-reject and that file will contain a list of email
> addresses and/or domain names of senders to be rejected. The file might
> look like this:
>
> *@spamhost.com
> peter@???
>
> Anyhow - I need a conditional - and not sure how to do this where I say
>
> if $h_from: [is in /etc/spammerslist <- this is the conditional I need]
>    then fail

>
> Using partial-lsearch I guess - how do I write that conditional ?


Firstly, you do not want to do tests on $h_from. That is pretty useless,
as spammers put all sorts of junk, often malformed, in there. Secondly,
it is legal (though rare) to have multiple addresses in From: headers.
And of course there is more than just an address in From: as well. It
can contain arbitrary comment text.

What you want to test is the envelope sender address ($sender_address).

Secondly, you can't do this in a system filter, because the system
filter is run only once per message. A message may have several
recipients, some of which may want to reject it, whereas others do not.

For the long term, your best way to approach this is to upgrade to Exim
4. This has much better facilities for doing this kind of thing. The ACL
features were designed with this kind of requirement in mind. In an Exim
4 ACL that is obeyed at RCPT time, you could put something like this:

  deny  message = The recipient has blocked this sender.
        senders = ${if exists{/home/$local_part/.spam-reject} \
                  {lsearch*@;/home/$local_part/.spam-reject}}


No need to mess with a system filter, and furthermore, the rejection
happens at RCPT time, before the message gets into your host.

--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.