[exim] acl variables per recipient rather than per message

Pàgina inicial
Delete this message
Reply to this message
Autor: Mike Cardwell
Data:  
A: exim-users
Assumpte: [exim] acl variables per recipient rather than per message
Hi,

If I set $acl_m0 to equal something in the rcpt acl I can refer to it in the
routers. If there is more than one recipient, I'll end up overwriting the
contents of that acl variable. I need to be able to store information on
a per recipient basis from the rcpt acl and then pull the relevant data out
in a router.

I've seen workarounds for this which involve defering all but the first
recipient, but that seems like a nasty hack. So I've come up with another
nasty hack which I hope you can confirm is safe, or tell me there's a better
way ...

In the rcpt acl I have:

warn set acl_m0 = $acl_m0\n$local_part@$domain=${quote:${lookup mysql{QUERY}}}

So each time around the rcpt acl we have $acl_m0 appended with some more
information eg:

\nrcpt1@address = "column1=somedata\ncolumn2=somemoredata"
\nrcpt2@address = "column1=otherdata\ncolumn2=someotherdata"

It does need to be set in the rcpt acl rather than in the routers, as that is where
it is used first.

QUERY actually returns a single cell of the format "column1=value2\ncolumn2=value2".
This is because I'm using a stored function. I tried using MySQL5.0 stored
procedures with exim, but I guess that isn't supported yet? The contents of
column1 and column2 are very strict so problems wont be caused by the return value
of that query.

So ... each recipient above will go through the routers. In the router I can pull
out the contents of $acl_m0 for the current rcpt with something like:

${extract \
   {column1} \
   {${expand:${extract \
         {$local_part@$domain} \
         {$acl_m0} \
   }}} \
}


It works in the tests I've done... What have I missed? What have I miss-used?

Mike, hoping this thread isn't as heated as the last one he started :)