Home arrow Applications Tips arrow Copy Emails Send by a Mail Server to an address
Copy Emails Send by a Mail Server to an address PDF
Sunday, 01 June 2008

Sometimes it is useful to send copy of mails sent by some email addresses within an organization to an address for audit purposes. This tutorial will shows how to configure postfix to do this task.

We asume you have installed and configured postfix as a mail server.

We will automaticaly BCC (send blind carbon copy) the email to an address using always_bcc variable.

Edit /usr/local/etc/postfix/main.cf and add the following line:

always_bcc = This e-mail address is being protected from spam bots, you need JavaScript enabled to view it

After that restart postfix by issuing:

/usr/local/etc/rc.d/postfix reload

Note: This setup will send a blind copy of every email sent through mail server to This e-mail address is being protected from spam bots, you need JavaScript enabled to view it .
If you do not want to receive a copy of every email sent by every user, but only to receive copy from emails sent by some users, you can create a blind carbon copy map with list of that users. It is also possible to send copy of emails to multiple emails addresses too.


Define a BCC map within postfix:
Edit /usr/local/etc/postfix/main.cf and add the following line:

sender_bcc_maps = hash:/usr/local/etc/postfix/sender_bcc

After that, create a file /usr/local/etc/postfix/sender_bcc with the following content

This e-mail address is being protected from spam bots, you need JavaScript enabled to view it               This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
This e-mail address is being protected from spam bots, you need JavaScript enabled to view it               This e-mail address is being protected from spam bots, you need JavaScript enabled to view it

Save file and exit.

Note that This e-mail address is being protected from spam bots, you need JavaScript enabled to view it is the username of an email account from your mail server.
If you do not have username as user@domain, but only user, then use:

user1              This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
user2              This e-mail address is being protected from spam bots, you need JavaScript enabled to view it

Also note that This e-mail address is being protected from spam bots, you need JavaScript enabled to view it could be on other mail server.

If you want to send copy on the same server and username are as user (without domain name) you can use:

user1            miguel
user2            miguel

Next step: run postmap over the newly created file to build Berkeley  DB for map file:

postmap /usr/local/etc/postfix/sender_bcc


Last step is to restart postfix:

/usr/local/etc/rc.d/postfix reload


Last Updated ( Monday, 02 June 2008 )
 
< Prev   Next >

Other BSD Systems

OpenBSD

Misc

Solaris

Polls

Best BSD firewall?