Setup a Postfix outgoing BCC based on SMTP username (not sending email address)

postfix

Our goal is to have a copy of any email sent by a specific SMTP user account bcc'd to another email address.

With Postfix, we can setup an outgoing email address to always BCC another address on messages that are sent.

This can be done with a line in main.cf:

sender_bcc_maps = hash:/etc/postfix/sender_bcc 

And then in /etc/postfix/sender_bcc:

user@company.com bcc@company.com

But if the user simply changes thier outgoing mail settings to send mail as user1@company.com, the BCC breaks. What the user can't change, however, is their SMTP username.

So we really need a way to setup Postfix to create a BCC when a message is sent by an SMTP user logged in as user, regardless of what email address that person claims to have.

Is this possible? How?

Best Answer

You may use reject_sender_login_mismatch to force match between smtp auth and envelope sender address. It may deliver solution acceptable for most situations.