How can I forward to a specific MTA based on email address?

Solution 1:

Postfix offers the ability to forward to different servers based on the recipient username by using transport tables. These tables can be stored as text files or in a database. For example:

[email protected] smtp:legacymail.example.com:25  
[email protected] smtp:newmail.example.com:25

Source: http://www.postfix.org/transport.5.html

Per-user transport tables could be used to enable a smooth gradual migration.

  1. Set up a postfix server that forwards mail for all users to the existing ISP
  2. Update DNS so MX record points to postfix server
  3. Wait for DNS to propagate.
  4. Edit transport table so mail for a few users is delivered to new server
  5. Update settings on computers for that batch of users
  6. Repeat steps 4-5 until all users have been migrated
  7. Update DNS so MX record points to new mailserver
  8. Shut down postfix server once traffic ceases

All users who are still using the legacy POP3 system can retain their SMTP settings, as long as that server is doing an MX lookup for users in the same domain. It won't work if their outgoing server is authoritative for the domain. It's possible that users on Exchange Server won't be able to send messages to users on the legacy system because messages will be delivered to the mailbox on Exchange Server.

To make this even more convenient for the sysadmin, Postfix could be integrated with a MySQL database and a web application that allows mail delivery to be toggled for batches of users.

Solution 2:

http://www.postfix.org/STANDARD_CONFIGURATION_README.html#some_local has some suggestions.

If you set up an internal Postfix, you can send mail to the appropriate host via transport_maps. Pulling into Exchange can be accomplished via forwarding to a domain on the new Postfix server which then redirects appropriately into Exchange.