Postfix email sandbox

Here an easy way to set up an email sandbox in Linux. All email sent from the server will be forwarded to an external email address.

1. Install postfix with pcre support.

apt-get install postfix postfix-pcre

2. Create the file /etc/postfix/virtual with the following line it (replace user@example.com with the email address that should receive all email).

/.*@.*/ user@example.com

3. edit /etc/postfix/main.cf and add the following line at the end

virtual_alias_maps = pcre:/etc/postfix/virtual

4. Restart postfix.