in reply to Getting BCC: header from a message.

I suspect you can use sendmail rules to rewrite the headers of the message, so it records the SMTP envelope "To" as a line in the message header, such as "X-Envelope-To".

Once upon a time, I was better at sendmail rules; but since I've switched my server to Exim, it's become a lot easier to handle things like this! ;-)

Update: I looked up the sendmail docs in the Bat Book. How's this for an idea: you could remove the "To" line from the email before it gets processed by sendmail. According to the docs, it will then record an "Apparently-To" header, which takes the address from the envelope.

35.10.2 Apparently-To:

When the message lacks a recipient

(sendmail) If the header of a mail message lacks recipient information (lacks all of the To:, Cc:, and Bcc: header lines), sendmail adds an Apparently-To: header line and puts the recipient's address from the envelope into the field of that line. This behavior is hard-coded into pre-8.7 sendmail, but beginning with version 8.7, it can be tuned with the NoRecipientAction option (see Section 34.8.43).

The Apparently-To: header name is not defined in RFC822. It is added by pre-8.7 sendmail because RFC822 requires at least one To: or Cc: header, and neither is present.

An Apparently-To: header should never be defined in the configuration file.

___
-DA