Skip to content

Postfix relay all mail to one mailbox

Postfix relay all mail to one mailbox

To configure postfix to relay all outgoing mail to one localmailbox is very easy.Use the following settings in your /etc/postfix/main.cf and reload your postfix daemon with “sudo postfix reload”

First configure the relay of all outgoing mail to one local mailbox:

always_bcc = yourusername@localhost

Second if you want to discard all outgoing mail too you need some extra settings  (this comes in handy when you are configuring a test server that must not mail to the outside world)

step 1) set a relayhost to a non-existant ip in your network

relayhost = 10.0.0.2

step 2) change the bounce queue settings so that bounced mail will be discarded instantly.

bounce_queue_lifetime = 0
maximal_queue_lifetime = 0

Now you are done! You have a test mailserver that can accept mail no matter to what e-mail adres it was addressed in the first place, deliver a blind carbon copy locally and discard the outgoing copy so that e-mail never leaves the server. You can use the command line program “mutt” to read the mail that has been delivered locally.

Rudolf Maduro – IT Specialist & Personal Life Coach

Published inPostfix

Be First to Comment

Leave a Reply

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