3

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?

  • Why do you even allow users to send from other email addresses? – sebix Aug 20 '17 at 8:14
4

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.

  • I agree that this would be the correct answer. Please explain this a little, though. – Esa Jokinen Aug 20 '17 at 7:21
  • It looks like there may be some additional setup required for this, since it relies on an SMTP username to email lookup table, smtpd_sender_login_maps. I wonder if there is a way to check if the user part of the email addresses matches the SMTP username without a lookup table (or with a regular expression)? – Nick Aug 21 '17 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.