Apparently it's sufficient if a redirect router has an empty data. The
router will decline and pass the message on to the next router anyway -
and address_data is still set. Exactly what I needed. Thanks for
pointing me to the right direction.
>
> *But*,
>
> why don't you set those informations in an ACL ? Which is more useful
> in the whole process.
I tried that, but the ACL is not run again if a later router redirects
a message to another user. E.g. one of the fields from the database is
the username, which is used to determine the directory to save the mail.
If a mail is sent to user1@??? the ACL would save the username
"user1", but the message may actually be redirected to
user2@???, the ACL is not run again, so the ACL var stays the
same and the username is still "user1" instead of "user2". Using a
router instead of an ACL the address_data is set again after a redirect.
>
> But²,
>
> If you have to many sql statements, increase the mysql cache.
Maybe. It just seems unreasonable to query the same record again and
again if all necessary fields could be fetched with a single query.
Basically, before I had :
router_autoresponder:
condition: ${ lookup mysql {SELECT autoresponder_enable FROM
mail_accounts WHERE ...
transport = transport_autoresponder
router_forward:
condition: ${ lookup mysql {SELECT forward_enable FROM mail_accounts
WHERE ...
unseen = ${ lookup mysql {SELECT keep_copy FROM mail_accounts WHERE
...
transport_autoresponder:
subject = ${ lookup mysql {SELECT autoresponder_subject FROM
mail_accounts WHERE ...
text = ${ lookup mysql {SELECT autoresponder_text FROM mail_accounts
WHERE ...
and so on.
Now I have
router_data:
data =
address_data = ${ lookup mysql {SELECT autoresponder_enable,
forward_enable, keep_copy, autoresponder_subject, autoresponder_text
FROM ...
router_autoresponder:
condition: ${ extract{autoresponder_enable}{$address_data}}
transport = transport_autoresponder
In this example, instead of 5 queries (in reality each with 1-2 joins)
it is only a single query and even easier to read/work with.
>
> hope that helps. Indeed, thanks!