Postfix/Dove copy incoming outgoing emails

dovecotpostfix

I have to copy a mail account's incoming and sent mails to another mail account on the same server as well. How can I do this?

The server is a debian wheezy running dovecot, roundcube and postfix. As I said the email isn't just an alias but an existing mailbox. The copying of the incoming mails can easily done with a sieve file in the user's profile:

01_forward.sieve

require ["fileinto"];
fileinto "Inbox";
redirect "user2@mail.com";

But as for getting a copy of every sent letters forwarded to user2@mail.com as well. I have no idea how to solve this.

Best Answer

Postfix should be enough to this scenario. Check the sender_bcc_maps and recipient_bcc_maps feature. As documented, two parameters defines an mapping where copies of particular mail account handled by postfix are sent to.

Assuming that your mail account is user@example.com and you want to copy it to external@example.net.

sender_bcc_maps = hash:/etc/postfix/special_user
recipient_bcc_maps = hash:/etc/postfix/special_user

In /etc/postfix/special_user add this line

user@example.com    external@example.net

Don't forget to postmap the map file and run postfix reload

Related Topic