Postfix copy every email to a central mailbox (send a copy of every mail sent via mail server to a given email)

Wednesday, 28th October 2020

Reading Time: 2minutes


Say you need to do a mail server migration, where you have a local configured Postfix on a number of Linux hosts named:



all configured to send email via old Email send host ( in each linux box's postfix configuration's /etc/postfix/
Now due to some infrastructure change in the topology of network or anything else, you need to relay Mails sent via another asumably properly configured Linux host relay (

Usually such a migrations has always a risk that some of the old sent emails originating from local running scripts on Linux-host1, Linux-Host2 … or some application or anything else set to send via them might not properly deliver emails to some external Internet based Mailboxes via the new relayhost

E.g. in /etc/postfix/main.cfLinux-Host* machines, you have below config after the migration:

relayhost = []

Lets say that you want to make sure, that you don't end up with lost emails as you can't be sure whether the new email server will deliver correctly to the old repicient emails. What to do then?

To make sure will not end up in undelivered state and get lost forever after a week or so (depending on the mail queue configuration retention period made on Linux sent MTAs and mailrelay, it is a very good approach to temprorary set all email communication that will be sent via a BCC emaills (A Blind Carbon Copy) of each sent mail via relay that is set on your local configured Postfix-es on Linux-Host*.

In postfix to achieve that it is very easy all you have to do is set on your a postfix config variable always_bcc smartly included by postfix Mail Transfer Agent developers for cases exactly like this.

To forward all passed emails via the mail server just place in the end of /etc/postfix/mail.conf after login via ssh on

Now all left is to reload the postfix to force the new configuration to get loaded on systemd based hosts as it is usually today do:

# systemctl reload postfix

Finally to make sure all works as expected and mail is sent do from do a testing via local MTAs. 

Linux-Host:~# echo -e "Testing body" | mail -s "testing subject" -r ""

Linux-Host:~# echo -e "Testing body" | mail -s "testing subject" -r ""

As you can see I'm using the -r to simulate a sender address, this is a feature of mailx and is not available on older Linux Os hosts that are bundled with mail only command.
Now go to and open the in Outlook (if it is M$ Office 365 MX Shared mailbox), Thunderbird or whatever email fetching software that supports POP3 or IMAP (in case if you configured the common all email mailbox to be on some other Postfix / Sendmail / Qmail MTA). and check whether you started receiving a lot of emails 🙂

That's all folks enjoy ! 🙂

Share this on:

Download PDFDownload PDF

Tags: , , , , , , , , , , , , , , , , , , ,

Leave a Reply

CommentLuv badge