How to run different mailservers side by side for the same domain

We are migrating from our old mail server to a new one with a completely different internal structure and many new features. I am using imapsync to migrate the data over (slow, but it works well). Before we do the last sync, my boss asked me to figure out a way to run the servers side by side so we could have the early adopters try the new mail server. The kicker is that both servers are set up to serve the same domain and we need to be able to have the early adopters get to their mail from either server.

This solution works for us, but I am not sure if this is the best solution and would love to hear your ideas.

1. Set up a NewMailForwarder server (I used postfix, but any MTA will work) that has an alias file which contains local users for all accounts that are pointed to the domain (e.g. user1: user1.example.com). This server will simply forward mail from the new mail server to the old mail server.

2. Set up an OldMailForwarder server that has the same alias file. Also set up dnsmasq on it as a local dns server and have its MX record for the domain point to the new mail server. This server will then forward all email to the new mail server.

3. Set up rules on the new mail server on each account such that any incoming message is redirected to @NewMailForwarder if not “X-archive: TEST” (pick your own header here. This will cause any email to the new mail server to get forwarded unless the header “X-archive: TEST” is true. This is needed to stop mail loops between the old and new mail servers.

4. Finally for any user that needs to test the new mail server set up a rule that adds “X-archive: TEST” and mirrors all their incoming email to @OldMailForwarder. I mirror the email so they test user can easily switch back to the old mail server an see their email.

So a test user has the following scenarios:

Outside email to the test user goes to the old mail server and is forwarded to the new mail server via the OldMailForwarder server with the “X-Archive: TEST” set so it is not forwarded any more.

Inside email from users on the old mail server to the test user are forwarded to the new mail server via the OldMailForwarder server with the “X-Archive: TEST” set so it is not forwarded any more

Mail from the test user on the new mail server to outside users is delivered directly.

Mail from the test user on the new mail server to inside users on the old mail server is forwarded to the old mail server via the NewMailForwarder server.

Mail from the test user on the new mail server to inside users on the new mail server is forwarded to the old mail server via the NewMailForwarder server which is then forwarded to the new mail server via the OldMailForwarder server with the “X-Archive: TEST” set so it is not forwarded any more.

The only downside is that the new mail server doesn’t have any server side rules that may be on the old mail server so the test user may see a lot of email in their inbox.