Re: [Exim] filters

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: Steven Pokrandt
CC: exim-users
Subject: Re: [Exim] filters
On Sat, 12 Jul 2003, Steven Pokrandt wrote:

> Is It possible to access a database within a filter.. I would like to
> lookup the senders address something like this
>
> # Exim filter
> #if ${lookup mysql select sender where user='${quote_mysql:$local_part}'
> and sender='${quote_mysql:$sender_address}'} is $sender_address
> #then
> # mail to $sender_address
> # mail text exists in database
> #else
> # mail to $sender_address
> # mail text DOSEN't exists in database
> #endif


Basically right; small syntax errors. Try this (untested):

# Exim filter
if "${lookup mysql {select sender where user='${quote_mysql:$local_part}'\
and sender='${quote_mysql:$sender_address}'}}" is $sender_address
then
mail to $sender_address
mail text "exists in database"
else
mail to $sender_address
mail text "DOSEN't exists in database"
endif

... and I'm no SQL expert, but don't you need "from something" in the
SQL query?


--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book:    http://www.uit.co.uk/exim-book