Note: Now that Google is hosting email domains for free, it has become an interesting alternative for both new and old domains. As always, I’ve changed the names to protect those affected.
Transitioning a domain to Google can be an arduous task. Once you have set up the domain with Google and added all the users, it may seem that the only option is to flip the switch and route all email to Google via your MX records. If you are using Postfix, you can redirect individual users. This gives you the opportunity to prepare each individual user to use Google before flipping the final switch.
The key aspects of Postfix that allow this to work are relay domains, virtual alias domains, and the trivial-rewrite daemon (via the transport table). The concept that is hard to grasp is that you are not going to redirect individual users to Google, but the entire domain. Then, you’ll force local users to stay local until you have migrated them to Google. Here’s an example using the example.com domain and three users: Jim, Fred, and Betty.
/etc/postfix/main.cf
relay_domains = hash:/etc/postfix/relay_domains
transport_maps = hash:/etc/postfix/transport
virtual_alias_maps = hash:/etc/postfix/virtual
/etc/postfix/relay_domains
example.com OK
/etc/postfix/transport
example.com smtp:ASPMX.L.GOOGLE.COM
/etc/postfix/virtual
betty@example.com betty
fred@example.com fred
jim@example.com jim
Note that we did not include the usual “domain_name any_text” syntax before the virtual aliases in /etc/postfix/virtual. Although this would be common in a normal virtual alias domain set up, we want to only virtual alias for particular user names, not the whole domain.
In this configuration, email for all three users is being delivered locally (in this case, to real UNIX users). When a user is ready to be forwarded to their example.com Google account, simply comment out the entry in /etc/postfix/virtual and rebuild the hash table with postmap.
Note: Wietse Venema, the creator of Postfix, explained how to do this in the Postfix mailing list in January 2000. That’s the only documentation I could find that gave a good example of what to do.

Get Slaptijack updates delivered to your Inbox or RSS Reader for free!
August 28th, 2007 at 10:34 pm
I have mandrake 10 and got postfix 2.0 as POP3 mail server but uses a relay host at the ISP for mail relay as the SMTP.
How do I redirect 3 e-mails for three users from the postfix 2.0 to their new exchange 2003 server.
thanks
ira igini
August 29th, 2007 at 7:44 am
@Ira - If your mail server uses real users on the system (ie, users with accounts in /etc/passwd), you can easily forward individual users to a different email address by placing a file in their home directory named ‘.forward’ and putting the destination email address in that file.
If your solution is more complicated than that, drop my a line via my contact page, and we’ll work on it.
Good luck!
October 25th, 2007 at 4:43 am
Web Hosting Providers Directory
Sorry, it just sounds like a crazy idea for me