Top Nav

Postfix Mailtrap

Recently we needed to setup a postfix server that would route all email to a local mailbox regardless of original destination. Here’s the solution:

1) Add this line to /etc/postfix/main.cf (if it’s not already present):

recipient_canonical_maps = regexp:/etc/postfix/canonical

2) Add the following line to /etc/postfix/canonical (replace “username”):

/.*/ username@localhost

3) Run “postfix reload”

That should make it deliver all mail to the specificed local user. Make sure localhost is in the mydomains file (or the mydomains setting in main.cf, if it doesn’t use a seperate file), or just use any valid local domain.