your requirements are still not very clear. are you trying to modify FROM/TO/BCC based on some business rules?..or splitting up the various parts of all emails into some central indexing buckets?
i wouldn't even attempt the former..and for the latter there are easier and more reliable solutions like always storing a copy of every email sent thru sendmail, onto an indexing server.
but for all i know my guesses could be completely off the mark.
the hardest line to type correctly is: stty erase ^H