Postfix: How to BCC theself on outgoing mails only if I’m not already in the recipients list

postfix

To avoid setting up Bcc or sent mail locations manually on every email client I set up to access my mail server (Debian Wheezy + Postfix + Dovecot IMAP), I've configured my Postfix server to automatically BCC me every message I send out through it, by using a sender_bcc_map like this:

$ cat sender_bcc
me@domain.uk    me+bcc@domain.uk

so every email I send out, where the sender is my email address, gets bcc'd back to me+bcc and so lands in my Inbox.

There's a problem with this though – if I send a mail to myself to remind me to do something or to look at a link (something I often do if I find a site on my phone that doesn't render properly and want to note it to view later on my desktop) I get two copies.

Is it possible to set up Postfix so it only adds the BCC if I'm not already in the To:, Cc: or Bcc: field?

Is there a more threading-friendly way of achieving this server-side Post Copy To Inbox scheme (perhaps not using Bcc) such that when I have threaded mode enabled in my mail clients (I use variously GNUs, Thunderbird and K9-mail depending on my device) the message will appear in the same thread as replies from others? Is there perhaps some way to just tell Postfix to deliver a mail into my inbox as if my mail client had put it there via IMAP?

A bit about my IMAP configuration:
My IMAP server is Dovecot, and my mailboxes are mbox.
INBOX is /var/mail/me , other folders are mbox files in the ~me/mail directory.

Best Answer

First, you will receive the two copies because the first is the one addressed to you, and the second is the bcc itself. In other words, it is working as intended.

I think a better solution for you would be to create an oversight email box at a separate email address. That way all copies are forwarded once to the oversight box. Use whatever mail client you want to attach via Dovecot to the mailbox and view it as needed. In effect, you just create a single email-only account and keep it separate.

I use this at work to handle he same functionality and it works great; there is even a small cron job to use tmpwatch to clear out old email after a period of time, as it stores the messages in maildir format. Makes the entire thing fairly hands off.