Can I force Exim to relay mails with unknown recipient to another host?


I want to stage the Exim to Exchange migration in a way that would allow me to move individual accounts between servers and keeping all accounts functional.

My idea is to:

  1. configure Exchange to act as Internal Relay, ie. to relay unrecognized recipients to Exim,
  2. perform an analogous configuration on Exim and enforce any form of loop protection at either end (for messages that are unknown on both servers),
  3. keep Exim as MX records target until the end of staging,
  4. gradually create new accounts on Exchange and disable them on Exim at the same time

I'd also welcome any criticism if the idea sounds crappy for any reason.

  • Are you trying to do a gradual rollout, then? Or are you doing this just because it takes time to migrate so many user accounts? – Michael Hampton Aug 8 '18 at 12:52
  • @MichaelHampton It's a common scenario when not only MTA/POP/IMAP migrated but also MUI is changed to the something new and unfamiliar for users. Even when hundreds of users are forced to move, say, from the TB to the OWA, helpdesk has alot of headache. Gradual migration allows to spread the cries and lament in the time. – Kondybas Aug 8 '18 at 14:33
  • @Kondybas I know why you would do a gradual rollout. I'm asking if that's what he's doing, or if he would be satisfied with moving all users at once. – Michael Hampton Aug 8 '18 at 14:38
  • It's a gradual rollout. We want to begin with small amount of users and slowly expand, to discover the issues early on, reduce their impact, and also get our helpdesk accustomed with the new product, and I think there are dozens of other reasons why this will be a better approach :) – Michał Sacharewicz Aug 8 '18 at 16:13

You can do that with combination of the ACL and the router.

First you have to pass all the messages through the ACL that verify existence of the certain account:

accept   domains = +local_domains
         !verify = recipient
   set acl_m_fwd = go2xchg
. . . . 
# all the rest rules

Then you have to add the router:

begin routers
       driver = manualroute
    condition = {if eq{$acl_m_fwd}{go2xchg}}
   route_list = * 
    transport = remote_smtp
. . . . 
# all the rest routers

where is the IP-address of the Exchange server.

  • What about this? error in ACL: unknown ACL condition/modifier in "acl_m_fwd = go2xchg" Shall I in any formal way declare this variable? – Michał Sacharewicz Aug 9 '18 at 8:25
  • I've forget the set keyword in the ACL, sorry – Kondybas Aug 9 '18 at 9:26
  • Absolutely working :) – Michał Sacharewicz Aug 10 '18 at 11:38
  • A little question comes to my mind though. I've tested this against looping (ie. when one sends a mail to a recipient that does not exist on both servers) somehow hoping that at least Exchange would be preventing such loop, and it worked. The message seems to be passing twice through exim, no matter if I send it from Exim or Exchange. I wonder, why is it exactly two, since default Exchange recieve connector has the limit set to 12? – Michał Sacharewicz Aug 10 '18 at 11:41
  • @MichałSacharewicz I can't say something reasonable without details. May be you have some address rewriting that reinject the messages again into the inbound stream? – Kondybas Aug 10 '18 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.