Copy All In Out Email Postfix Zpanel

From MS Computech
Revision as of 10:37, 30 May 2014 by Snifer (talk | contribs) (Created page with "Case 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 do...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Case

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 main.cf file

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

/etc/postfix/main.cf
/etc/zpanel/configs/postfix/main.cf
/etc/zpanel/panel/etc/build/config_packs/centos_6_2/postfix/conf/main.cf
/etc/zpanel/panel/etc/build/config_packs/centos_6_3/postfix/main.cf
/etc/zpanel/panel/etc/build/config_packs/ubuntu_11_10/postfix/conf/main.cf
/etc/zpanel/panel/etc/build/config_packs/ubuntu_12_04/postfix/main.cf
/usr/lib/postfix/main.cf

You only need to modify one of them and that is /etc/postfix/main.cf . 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/main.cf always_bcc = [email protected] 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/main.cf

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 </pre>

Edit both files by adding line like this:

@domain.com [email protected]
@domain.eu [email protected]
@domain.nl [email protected]

Where @domain.com is the domain you want the email forwarded from and [email protected] 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.

<per> postmap /etc/postfix/sender_bcc postmap /etc/postfix/recipient_bcc </pre>

This creates the following files.

/etc/postfix/recipient_bcc.db
/etc/postfix/sender_bcc.db

Restart postfix

Now restart Postfix and your done.

postfix reload

Source