Re: [exim] set exim variable from perl script

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Kjetil Torgrim Homme
Ημερομηνία:  
Προς: Hans Klose
Υ/ο: exim-users
Αντικείμενο: Re: [exim] set exim variable from perl script
On Tue, 2008-11-25 at 15:29 +0100, Hans Klose wrote:
> can you explain this a little bit more. I is not realy clear
> for me how to do this.
>
> I need somethin like this
>
> ldap_lookup:
> debug_print = "R: LDAP Lookup Router"
> driver = manualroute
> set $variable_x= ${${perl{ldap_check_rcpt}{router}}
> if ${$variable_x} = defer {
> host_find_failed = defer
> }
> elso if ${$variable_x} = true {
> route_list = 192.168.0.10
> transport = remote_smtp
> }


you'll have to split this into three routers: one which sets the
variable $address_data, and one router for each case.

ldap_lookup:
driver = redirect
address_data = ${perl{ldap_check_rcpt}{router}}
# A redirect router with empty "data" will decline, so it will not
# influence routing -- the only effect of this router is to set
# $address_data
data =

defer_router:
driver = manualroute
condition = ${if eq {$address_data} {defer}}
host_find_failed = defer

success_router:
driver = manualroute
condition = ${if !eq {$address_data} {defer}}
route_list = 192.168.0.10
transport = remote_smtp

untested. this is just a translation of your pseudo-code, and I don't
even know what host_find_failed does :-)

if you need more than one "variable":

> >you can set $address_data (in a router) or an ACL variable with the
> >expansion from the perl code, then use extract to get at the bits. it's
> >easiest if the Perl script output is on the form "key1=value1
> >key2=value" and so on, then you can use ${extract{key1}{$address_data}}


-- 
regards,          | Redpill  _
Kjetil T. Homme   | Linpro  (_)