Exim: Relay unknown recipients to another server

Question

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

Scenario

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.


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:

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

Then you have to add the router:

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

where 11.22.33.44 is the IP-address of the Exchange server.