[Exim] How to reject all localparts not listed in mysql data…

Top Page
Delete this message
Reply to this message
Author: fk0512
Date:  
To: exim-users
Subject: [Exim] How to reject all localparts not listed in mysql database?
Hi,

How would I permanently reject all incoming emails that are addressed to recipients whose localparts are not listed in column "username" in table "recipient" of a mysql database "email" with a permananet error message "User does not exist!" ?

This is what I have so far:

MYSQL_SERVER=localhost
MYSQL_USER=mysqlusername
MYSQL_PASSWORD=mysqlpasswd
MYSQL_DB=email
MYSQL_SELECT_USERS=SELECT username FROM recipient
hide mysql_servers = "MYSQL_SERVER/MYSQL_DB/MYSQL_USER/MYSQL_PASSWORD"

deny message = User does not exist!
     local_parts = ! ${lookup mysql{MYSQL_SELECT_USERS}}


But I dont think I am doing it right.

Thanks for any help!

Regards,
Fahd