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.

Have a project or a problem?

Talk with a senior engineer for practical recommendations—no obligation.

Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Categories

Get a free consultation from Reliable Penguin

Submit the form—or for immediate service call 866-649-7984.