Redirecting postfix email to a different email account

Problem

You have setup your Rails app to send out emails using postfix, but you also want to redirect the incoming emais to a different account.

Solution

Edit the postfix configuration file vi /etc/postfix/main.cf and add the following two lines at the bottom:

virtual_alias_domains = outgoing_domain.com
virtual_alias_maps = hash:/etc/postfix/virtual

And then add the redirections to the virtual file with vi /etc/postfix/virtual:

outgoing_email@outgoing_domain.com           other_account@other_domain.com
@outgoing_domain.com                         other_account@other_domain.com

Then run the following two commands to restart postfix:

postmap /etc/postfix/virtual
postfix reload

* Based on the post here