procmail
[Top] [All Lists]

Re: Help adding To: and CC: to message body

2004-10-14 15:46:45
On Thu, Oct 14, 2004 at 05:44:48PM -0400, Christopher Benson wrote:

I tried looking in the Archives but I'm not super handy with regular
expressions so looking for "How to add To: and CC: to message body"
brought up about every message.  So I have a recipe that works but it
only seems to work for plain text emails.  If emails are MIME encoded
(marked up emails like from outlook) it doesn't work since it's more
like HTML behind the scenes.  Has someone been able to get this to
work?  You can see my lame attempt and putting in some html type
markup but it didn't work.  Any pointers are appreciated.

Btw, you aren't the Chris Benson I know from San Francisco, right?


# Capture the To line and put it in TOWHO
:0
* ^To:\/.*
{ TOWHO=$MATCH }

# Capture the CC line and put it in CCWHO
:0
* ^CC:\/.*
{ CCWHO=$MATCH }


One point here: you will want to claer the $MATCH var before each of
these.  Otherwise, e.g., if there is a blank To: or Cc: line, you
will assign the previous value of $MATCH to your var.

  MATCH
  :0
  * ^To:.*\/[^  ].*
  { TOWHOM = $MATCH }

  MATCH
  :0
  * ^Cc:.*\/[^  ].*
  { CCWHOM = $MATCH }


As for injecting text into MIME-encoded messages, it is very
difficult.  I shows a half-effort at it about two weeks ago,
actually, but that was a failure.

(I bet Ruud is getting his competitive sesnsibilities piqued about
now.  Go for it, Ruud!) :-)

-- 
dman

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>