in reply to Getting BCC: header from a message.
Their own information is based on information gleaned from the SMTP conversation, rather than the message body itself, if you haven't already read the RFC on SMTP, I'd suggest it be your bedtime reading for the next week or so :o)
In essence, SMTP provides a very basic conversation -- HELO, MAIL FROM: <address>, RCPT TO: <destintation address>, DATA,<message body>, .,QUIT. It doesn't care what the message body says.
To solve your problem, you need to be the MTA or at least heavilly in bed with it -- in fact MTAs are very good at doing what you're trying to achieve, as it's what they're designed for.
My advice would be rather than writing an MTA in perl, possibly using the Net::SMTP::Server module, you could consider writing a bit of perl that could modify virtual alias files for your MTA (postfix finds this particularly friendly)
--
RatArsed
|
|---|