Forward a COPY of an email to another address with postfix

Send duplicates of e-mail messages received for a particular user to mail of another account of the same system.

Go to /etc/postfix
Edit file /etc/postfix/main.cfg and add a new line:
recipient_bcc_maps = hash:/etc/postfix/recipient_bcc

Then create a file /etc/postfix/recipient_bcc and add, as needed, new lines, listing the primary recipient of the messages and then the account which will be receiving the duplicate of the message, like this:
john william

Then run:

postmap /etc/postfix/recipient_bcc
/etc/init.d/postfix reload

Now, as soon as john receives an e-mail, a copy of that e-mail is copied to william too.

Note: You may experience a situation where the second recipient keeps receiving two copies of the same mail. This may be caused by postfix processing the same message twice, as the case is, obviously, if anti-spam filters are engaged. To fix the problem, go to /etc/postfix/master.cfg and add another options line under the record for your SMTP delivery agent, saying “-o receive_override_options=no_address_mappings“.

In my case it looks like this:

# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - - - - smtpd
    -o content_filter=spamfilter
    -o receive_override_options=no_address_mappings

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s