Re: [exim] $message_body lsearch

Top Page
Delete this message
Reply to this message
Author: Dave Lugo
Date:  
To: exim-users
Subject: Re: [exim] $message_body lsearch
On Tue, 31 May 2011, Hans Klose wrote:
>
> I have a rule which searches the mail body for given sentences.
> I would like to put these sentences from the configuration
> into a file.
>
> deny message = STOP!
> condition = ${if or { \
>    {match {${lc:$message_body}}{.*this is sentence one.*}} \
>    {match {${lc:$message_body}}{.*this is sentence two.*}} \
>    {match {${lc:$message_body}}{.*this is sentence three.*}} \
>    }{1}{0}}

>
> I tried something like
>
> condition = ${if match{$message_body}{lsearch;/etc/local/exim/test-word}{yes}{no}}
>
> with no success.
>
> Wow can I do this?
>
> Regards Hans.
>


I use (simplified) this in a stanza in the DATA acl (mind the wrap):

deny     regex        = <; (?i)${readfile{/somedir/regex-blacklist}{;(?i)}}4868de5c9135e39ea81d8f090a8411c0


It might do what you need.

The '<;' and 4868de5c9135e39ea81d8f090a8411c0 was because
I was paranoid that end of file or newline might get
accidentally matched. Don't recall the exact details, as
it's been a few years.

-- 
--------------------------------------------------------
  Dave Lugo     dlugo@???      No spam, thanks.
  Are you the police?  . . .  No ma'am, we're sysadmins.
--------------------------------------------------------