Re: [Exim] $sender_data in 4.34?

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: Marilyn Davis
CC: exim-users
Subject: Re: [Exim] $sender_data in 4.34?
On Tue, 22 Jun 2004, Marilyn Davis wrote:

> I tried:
>
> get_outside_id:
>   driver = redirect
>   senders = mysql;select id from fake where \
>             address = '${quote_mysql:$sender_address}'
>   debug_print = get_outside_id sender_data = $sender_data
>   data =

>
> get_inside_id:
> driver = redirect
> debug_print = get_inside_id sender_data = $sender_data
> address_data = ADDRESS_INFO
> data =


$sender_data is only valid for the router in which the lookup occurs. It
is not preserved from router to router. If you want to save the data, add

address_data = $sender_data

to the first router. That sets $address_data, which is preserved.

> One thing I'm sure I don't understand is the difference between the 2
> syntaxes:
>
> mysql;select
>
> and
>
> ${lookup mysql{select


The second of those changes the value of the option every time it is
used. This textual manipulation is the same for all expanded options. It
is not specific to any option. No option does anything special as a
result of having its text changed (or not changed). You can think of it
as a kind of pre-rewrite. In your particular case, the text string is
interpreted as a list AFTER it has been rewritten.

The first of those is a special kind of item that is valid in domain,
host, and address lists. It uses a lookup as a way of testing whether
something (a domain, host, address) matches a list, i.e. is in a
particular set of domains, hosts, or addresses. The simplest lookup is
lsearch, which just searches a list in a file. But this is inefficient
for long lists. DBM or cdb files put the list into an indexed form for
efficiency and similarly a database query can be used to perform the
test "is this domain/whatever in this list?". The fact that these
lookups can *also* return data is not the main point here, but
$sender_data etc are provided as a side-effect, because they can
sometimes be useful.

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