[exim] Select a router per recipient on incoming messages

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Marco van Tol
Dátum:  
Címzett: exim-users
CC: Marco van Tol
Tárgy: [exim] Select a router per recipient on incoming messages
Hi there,

I apologise if this has been handled before.  I wasn’t sure what a quick path in the FAQ would be to the answer for this.

I have a domain for which different local_parts need to be delivered to different SMTP servers.
The decision depends on whether "host-a" accepts the local_part, and otherwise it needs to be our local SMTP server.

I created these relevant config snippets for it:
(I did not paste the entire config file, just the parts relevant to my question)

```
local_domains = mydomain.tld

begin acl
  acl_smtp_rcpt:
    accept domains = +local_domains
           verify = recipient/callout
           set acl_m_hosta = "ok"

    accept domains = +local_domains
           message = $acl_verify_message
           verify  = recipient/defer_ok

    deny message = relay not permitted

begin routers
    hosta_verify_router:
        driver = manualroute
        domains = +local_domains
        transport = internal_smtp
        route_list = +local_domains mx.hosta.com
        verify_only = true

    # Relay to the GMail MX for gmail_domains
    hosta_inbound_relay:
        driver = manualroute
        domains = +local_domains
        condition = ${if eq {$acl_m_hosta} {"ok"}}
        transport = internal_smtp
        route_list = +local_domains mx.hosta.com <http://mx.hosta.com/>

    route:
        driver = manualroute
        domains = +local_domains
        transport = internal_smtp
        route_list = +local_domains my-mx.mydomain.tld

begin transports
    internal_smtp:
        driver = smtp
```

This works great, as long as you have one recipient per connection.

But, when I tested what happened with 2 “RCPT TO” commands in a single connection, one for host-a, and one for local, I found out the contents of the acl_m_hosta is persistent between “RCPT TO” calls.

Digging a bit further into this I found out that the router finds the variable in a state where the last verify left it, and all addresses would be handled by the same router.

My question is this:
Is there an easy way to decide per recipient which router will be used, based on the results of a callout/verify?
Or is there a different way to establish the same result?

Thank you so much in advance,

Marco van Tol


--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/