Re: [Exim] $sender_data in 4.34?

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Philip Hazel
Dátum:  
Címzett: Marilyn Davis
CC: exim-users
Tárgy: Re: [Exim] $sender_data in 4.34?
On Sun, 20 Jun 2004, Marilyn Davis wrote:

> I read this, from the changelog, to say that the lookup must succeed
> but not that the condition must succeed:


So do I! :-)

> Version 4.34
> ------------
>
>  1. There are two new variables called $recipient_data and $sender_data. These
>     are set from a lookup success in an ACL "recipients" or "senders"
>     condition, or in a router "senders" option, similar to $domain_data and
>     $local_part_data. They remain set until the next senders or recipients
>     test. Thus, you can do things like this:

>
>       require recipients      = cdb*@;/some/file
>       deny    some further test involving $recipient_data

>
> ****
>
>
> But, both succeed this time:


> get_outside_id:
> driver = redirect
> senders = ${lookup mysql{select address from fake}}
> debug_print = get_outside_id sender_data = $sender_data
> data =


Well, no, they don't. At least not in the right way...

I'm afraid you have fallen into a well-known trap of understanding what
is going on here. It is an unfortunate gotcha in Exim. Lookups can be
used in lists (in this case an address list) in two different ways:

(1) Simply to re-arrange the list as part of an expansion. This is what
you are doing above. The expansion happens before Exim even tries to
process the string as a list. Nothing special happens; the string is
just re-written according to the expansion rules.

(2) As a way of implementing an index, using a lookup mechanism. This is
the way that sets $sender_data. When the indexed lookup succeeds, the
key matches the list, and the data is saved. Try

  senders = mysql;select something from something \
            where something = '${quote_mysql:$sender_address}'


Notice that the example I quoted above is

 require recipients      = cdb*@;/some/file


and not

 require recipients      = ${lookup {$local_part@$domain}cdb*@{/some/file}}





--
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