I'm trying to forward e-mails matching a certain pattern to a set of addresses, and BCC the same e-mail to some other e-mail addresses. From looking at my procmail log, it appears that all my rules are matching, yet the BCC recipient does not receive the message.
The relevant lines of my .procmailrc look like this:
:0fhw
* ^From.*@example.com
* ! ^X-Loop: test
| formail -A "Bcc: $BCCS"
:0fhw
* ^From.*@example.com
* ! ^X-Loop: test
| formail -A "X-Loop: test"
:0
* ^From.*@example.com
* ! $DEST ?? ^$
! $DEST
At the point this part of the procmailrc is reached, the BCCS
variable contains the address(es) to BCC, and the DEST
variable contains the address(es) to forward to.
In the log I see something like this:
procmail: Match on "^From.*@example.com"
procmail: Match on ! "^X-Loop: test"
procmail: Executing "formail,-A,Bcc: bcctest@somewhere.com"
procmail: Match on "^From.*@example.com"
procmail: Match on ! "^X-Loop: test"
procmail: Executing "formail,-A,X-Loop: test"
procmail: Match on "^From.*@example.com"
procmail: Match on ! "^$"
procmail: Executing "/usr/sbin/sendmail,-oi,user1@somewhere.com,user2@somewhere.com"
procmail: Assigning "LASTFOLDER=/usr/sbin/sendmail -oi user1@somewhere.com,user2@somewhere.com"
procmail: Notified comsat: "michael@:/usr/sbin/sendmail -oi user1@somewhere.com,user2@somewhere.com"
It appears that a Bcc: header is being added and the e-mail forwarded as I expect. My assumption from what I have gathered from my research is that to BCC in the forward I need to add a "Bcc:" header, and sendmail will copy the message to any addresses it specifies and strip the Bcc: header off in the actually sent e-mail. However I am not 100% sure, as all the questions I have found regarding BCC deal with people wanting to trigger on BCC on the incoming message, which can't really be done if the sending server is configured properly.
Am I doing something wrong?