2

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.

snowlinux
  • 21
  • 2
  • are you using procmail? if not, you could use it to create a filter on all incoming and outgoing mail – RapidWebs Oct 10 '14 at 15:09
  • This will be a postfix setting. Look at the [virtual](http://www.postfix.org/virtual.5.html) and [aliases](http://www.postfix.org/aliases.5.html) functions, you should be able to achieve what you desire. – Gene Oct 10 '14 at 15:38

1 Answers1

2

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

masegaloeh
  • 18,236
  • 10
  • 57
  • 106