I'd rather prepend the X-Header-From line before "From:" because I could imagine that "To:" will be omited if the message is addressed to only BCCs.
And I think on the second line of your header checks, the pipe symbol should be escaped, but I'm not sure. I'd put it on separate lines with the same effect, just to be sure:
Code:
/^To: (.*)/ PREPEND X-Header-From: journaling@xyz.com
/^Cc: (.*)/ PREPEND X-Header-To: $1
/^Bcc: (.*)/ PREPEND X-Header-To: $1
Also note the $1 substitution.
But, hmm, I think that BCC is not part of the mail headers, BCCs get mentioned only in the SMTP communication when transporting the message.
Also note that the effect of this would be adding these headers to EVERY message that flows through the MTA in or out, unless you use some other forms of filtering.