autoresponder:
  driver = redirect
  domains = +local_domains
  condition =
  data =
  allow_fail
  allow_defer
  no_verify
  no_expn
  check_ancestor
  unseen
  more
  pipe_transport  = address_pipe
  reply_transport = address_reply
*redirect_router = NEXTROUTER*

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 [email protected] the ACL would save the username "user1", but the message may actually be redirected to [email protected], 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

router_forward:
  condition: ${ extract{forward_enable}{$address_data}}
  unseen: ${ extract{keep_copy}{$address_data}}

transport_autoresponder:
  subject: ${ extract{autoresponder_subject}}
  text: ${ extract{autoresponder_text}}


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!

David

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Reply via email to