Wietse Venema:
> Ralf Hauser:
> > Hi,
> > 
> > Messages with a certain content type should be bcc'd to an additional
> > address for my use-case at hand.
> 
> That is currently not built into Postfix, but it could be done with
> a Milter: in the header and body event handlers look at the content,
> and in the end-of-message handler invoke the "add recipient" action.
> But I agree that having to do that would suck.
> 
> (The reason Milters can add BCC recipients but header/body_checks
> can't: Milter support was added later, and I have not found the
> make the BCC functionality available in header/body_checks).

I'm considering a design for BCC support in header/body_checks
that works in two stages:

- The first stage happens while an email message is received: build
  a list of recipients in header/body_checks BCC actions, suppressing
  duplicates on-the-fly.

- The second stage happens after the complete message and envelope
  are stored: add the BCC recipients to the queue file.

The header/body_checks syntax would look like this:

    /pattern/ BCC u...@example.com
    /pattern/ BCC u...@example.com NOTIFY=none ORCPT=u...@example.net

(for consistency, BCC recipients with NOTIFY and ORCPT attributes
should also be supported in access maps, sender_bcc_maps,
recipient_bcc_maps, and always_bcc).

        Wietse

> > I guess I could do this in two rounds:
> > 1) with header_checks relay to itself on a different port (FILTER)
> > 2) on that secondary smtpd, I could use the 
> > http://www.postfix.org/postconf.5.html#recipient_bcc_maps 
> 
> That would also work (assuming you are not already using an after-queue
> filter for other purposes).
> 
> > but there it says: "automatic BCC recipients are produced only for
> > new mail.  To avoid mailer loops, automatic BCC recipients are not
> > generated after Postfix forwards mail internally"
> 
> This is not a problem: you are sending mail out via SMTP and then
> receiving it via SMTP. That is not "internal" forwarding.
> 
> > P.S.: There appears to be a typo in "whitespace of comma" - I guess
> > this should be "or"
> 
> And thanks to cut and paste, this mistake happens 24 times in the
> same file.  Thanks for noticing that.
> 
> > P.P.S.: It would be useful to show a sample line of
> > /etc/postfix/recipient_bcc
> 
> The example in the text uses 
> 
> recipient_bcc_maps = hash:/etc/postfix/recipient_bcc
> 
> But I don't know if hash is the common use case.
> 
>       Wietse
> 

Reply via email to