[Exim] Exim, mysql and rcpt acl

Top Page
Delete this message
Reply to this message
Author: kimoexim
Date:  
To: exim-users
Subject: [Exim] Exim, mysql and rcpt acl
Hello,

FreeBSD 4.9 with Exim 4.41 with mysql from ports.

I have a table in mysql with email addresses that are allowed to send to
my domain. I have this in the rcpt acl:

  deny    message       = Sorry, you are not authorized to send to this user
          domains       = MYDOMAIN
          condition     = ${lookup mysql{select uid from users where
realemail='$sender_address' or listemail='$sender_address' or
rmail2='$sender_address'}{0}{1}}


This works fine. If you are not in the database, then you can't send to my
domain.

Now, I need to have another check that will allow anyone to send to
certain email addresses. In a differeny mysql table, is a list of email
address, where if they have a 1 in the next column, then they should be
allowed to receive email from anyone. What would be the best way to
achieve this. I was thinking something like:

  deny    message       = Sorry, you are not authorized to send to this
address
          domains       = MYDOMAIN
          condition     = ${lookup mysql{select external from mailalias
where listemail='$recipient'}{$value}{$value}


But I'm not sure what the proper recipient address variable would be (ie
like $sender_address). I guess another way would be to have

recipients = ${lookup mysql{select listemail from mailalias where
external='1'}{$value}fail}

But then I'd be worried about having to a 1000 entry table and having to
compare against every entry.

Any suggestions would be appreciated.
Thanks
Kimo R.