Your biggest problem here is that there is no BCC header, although some MTAs (such as sendmail) add their own information.

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


In reply to Re: Getting BCC: header from a message. by RatArsed
in thread Getting BCC: header from a message. by unixdown

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.