How to redirect all postfix emails to one external email address?

Create /etc/postfix/virtual-regexp with the following content:

/.+@.+/ [email protected]

Edit /etc/postfix/main.cf and add the file to virtual_alias_maps. The end result might look like this:

virtual_alias_maps = regexp:/etc/postfix/virtual-regexp

If you had existing virtual_alias_maps, separate the values with commas (eg. virtual_alias_maps = hash:/etc/postfix/virtual, regexp:/etc/postfix/virtual-regexp).

Build the mapfile by typing:

postmap /etc/postfix/virtual-regexp

Then restart postfix :

sudo service postfix restart

Voila!


As this took me some time:

If you want to exclude target domains from this, prefix the rule with

/[email protected]/ @exclude1.com
/[email protected]/ @exclude2.com
...

to preserve original recipient, i found the virtual manpage a bit confusing on how to achive this.