Re: [Exim] $sender_data in 4.34?

Página Principal
Apagar esta mensagem
Responder a esta mensagem
Autor: Marilyn Davis
Data:  
Para: exim-users
Assunto: Re: [Exim] $sender_data in 4.34?
On Mon, 21 Jun 2004, Philip Hazel wrote:

Thank you Philip. What a dazzling barrage of helpful emails!

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


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 =

From the debug:

MYSQL query: select id from fake where address = 'marilyn@???'
MYSQL new connection: host=localhost port=0 socket=NULL database=maildance user=root
lookup yielded: 1
marilyn@??? in "mysql;select id from fake where address = 'marilyn@???'"? yes (matched "mysql;select id from fake where address = 'marilyn@???'")
expanding: get_outside_id sender_data = $sender_data
result: get_outside_id sender_data = 1
get_outside_id sender_data = 1
calling get_outside_id router
rda_interpret (string):
expanded:
file is not a filter file
parse_forward_list:
get_outside_id router declined for marilyn@???
--------> get_inside_id router <--------
local_part=marilyn domain=maildance.com
expanding: get_inside_id sender_data = $sender_data
result: get_inside_id sender_data =
get_inside_id sender_data =
processing address_data
expanding: $domain

At least that gave me some $sender_data in the first router, but it seems
to be empty again in the second.

I'm sorry, I guess I don't understand yet.

One thing I'm sure I don't understand is the difference between the 2
syntaxes:

mysql;select

and

${lookup mysql{select

---

BTW, this, where I had mysql parse the local_part and domain:

  senders = mysql;select addresses.id from addresses, domains \
            where addresses.local_part \
                    = left('${quote_mysql:$sender_address}', \
                      locate('@', '${quote_mysql:$sender_address}') -1) \
            and domains.name \
                    =right('${quote_mysql:$sender_address}', \
                     char_length('${quote_mysql:$sender_address}') \
                     - locate('@', '${quote_mysql:$sender_address}')) \
            and domains.id=addresses.domain_id


also gave me $sender_data in the first router, but not the second.

My goal is to use the InnoDB table type to keep my data small, which,
hopefully, will give me more efficiency.

That's why things are so complicated.

However, I can put all my lookups into $address_data instead of
$sender_data and that will be fine.

Thank you to anyone for any clarifications you have time for.

Marilyn Davis

>
> Notice that the example I quoted above is
>
>  require recipients      = cdb*@;/some/file

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

>
>
>
>
>


--