procmail
[Top] [All Lists]

Re: PERL within .procmailrc

1999-08-10 13:34:58
Glen Lee Edwards <glenlee(_at_)inebraska(_dot_)com> writes:
I'm trying as an experiment to create a recipe that pipes all incoming
mail to PERL to modify the subject line to add in a list id [naztalk].
Following is what I'm using:

:0 fw: mstst.lock
| /usr/local/bin/perl -e "s/(Subject: )(.*)/\1\[naztalk\] \2/"

Four problems: you left off the 'h' flag to tell procmail to just feed
the header through perl, you're using an unnecessary locallockfile,
you forgot to anchor the match against the beginning of the line, and
you are using \1 instead of $1 on the righthand side of the substitution.

Give the following a try:

        :0 fhw
        | /usr/local/bin/perl -e "s/^(Subject:\s*)/$1[naztalk]/i"

If that doesn't work, put VERBOSE=on about it in the rcfile and then
check the log.


Philip Guenther

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