Tags for How-To Copy all in- and outgoing email of a certain domein with Postfix and Z-Panel

How-To Copy all in- and outgoing email of a certain domein with Postfix and Z-Panel

This instructions tells you how to make a copy of in- and outgoing emails from a certain domain server running Postfix and Z-Panel.


There are multiple domains on a (Z-Panel)server running multiple websites and email from different customer. One customer wants a copy of in- and outgoing email for 3 domains sent to a special email address.

More than one file

On a system with Z-Panel there are more than one files. Do be precise there are 7.


You only need to modify one of them and that is /etc/postfix/ . Forget oll the others.

Copy / Forward All email (from all domains, not what you want)

Postfix has the possibility to send a copy of all email to a specific email address. This means that all email from an to all email accounts on all domains is forwarded.
This can simply be don by adding this line in /etc/postfix/
always_bcc =
This is not an option if you have different customer with different domains on the server.

Copy / Forward all email from specific domain

This give you the possibility to forward email from only one domain (or as many if you want).

Add this lines in /etc/postfix/

sender_bcc_maps = hash:/etc/postfix/sender_bcc
recipient_bcc_maps = hash:/etc/postfix/recipient_bcc

Create the this two files: /etc/postfix/recipient_bcc and /etc/postfix/sender_bcc
touch /etc/postfix/sender_bcc
touch /etc/postfix/recipient_bcc

Edit both files by adding line like this:

Where is the domain you want the email forwarded from and the email address where a copy must be send to. Do this in both file. recipient_bcc is for incoming and sender_bcc for outgoing email.

Create the Postfix lookup tables

Before Postfix can do something with it you have to make the Postfix lookup tables. You have to do this every time you make changes in /etc/postfix/sender_bcc or /etc/postfix/recipient_bcc.

postmap /etc/postfix/sender_bcc
postmap /etc/postfix/recipient_bcc

This creates the following files.

Restart postfix

Now restart Postfix and your done.

postfix reload


It's also possible to forward only email from one user. In that case add the recipient to the sender_bcc and recipient_bcc file like this:

Post new comment
The content of this field is kept private and will not be shown publicly.
Deze vraag is om te controleren of u een persoon bent. Di is om spam berichten tegen te gaan.