procmail
[Top] [All Lists]

problems with subject replacement recipe

2001-03-12 22:01:30
Hi folks,

I'm having a problem with the follow recipe under procmail v3.10
1994/10/31 [ISP will be upgrading soon; users are not allowed to use their
own copy of procmail]:

:0    # is the subject tagged already?  If not, capture it
* ! ^Subject:.*\[PREFIX\].*
* ^Subject: *\/.*$
{    # strip off any leading "Re: " strings
  CURSUB=`echo $MATCH | sed -e 's/^ *R[Ee]: *//g'`
  :0 fhw
  | formail -I"Subject: [PREFIX] $CURSUB"
}
:0 Efhw    # see if it is a tagged reply; if so, move the "Re:"
* ^Subject: *(Re: *)+\[PREFIX\] *\/.*$
| formail -I"Subject: [PREFIX] Re: `echo \"$MATCH\" | sed -e 's/^ *R[Ee]: 
*//g'`"
################################

The recipe adds [PREFIX] before a subject header as follows:

 Subject: [PREFIX] This is a test

The recipe is supposed to then made replies look like this:

 Subject: [PREFIX] Re: This is a test

The problem is that any reply to the *original* post gets an extra space:

 Subject: [PREFIX] Re:  This is a test

Note that any replies to a message other than the original results in the
what I intended [ie: no extra space]. It's only when an e.mail is in
response to a message that doesn't originally have a Re: in the subject.

Am I going about the $MATCH or sed statement incorrectly? Any
enlightenment is appreciated.

/vjl/


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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