procmail
[Top] [All Lists]

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

2004-10-14 15:54:48
Christopher has this code


# 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 }

and Dallman said,

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.

If there's an empty To: or Cc: line, MATCH will be empty and thus so will the variable. If there's no To: or no Cc:, the condition will fail, procmail won't enter the respective set of braces, and the respective variable will not be assigned. There's no way for the previous value of MATCH to get into TOWHOM or CCWHOM.

If any variables should be cleared ahead of that code, it's TOWHOM and CCWHOM, in case To: or Cc: respectively is not present.

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.

Yes. IMO MIME-encoded messages aren't suitable for injection, only for ejection.

____________________________________________________________
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>