Ted Baltz wrote:
I'd like to have procmail invoke something to edit the Subject: header
of incoming mail. We've got this site-wide spam filter (puremessage)
that not only puts in a X-blahblahblah header with its spam probability
estimate, but it also prepends the subject of high-probability-spam
messages with [SPAM:#] (with some number of #'s from 1 to 5).
I'd like to remove this junk, as its redundant and often wrong. The
X-blah headers are of course fine, and I filter on them.
Basically, I want to turn "Subject: [SPAM#{1,5}] blah blah blah" into
"Subject: blah blah blah". Is there an easy / fast way to do this? I
am no sed expert!
Not sure about sed but in Perl that would be something like
:0fhw
* Subject: \[SPAM#
| /usr/bin/perl5 -n -p -e 's/^Subject: \[SPAM#[0-5]\] (.*)$/Subject: $1/'
The extra procmail match is kind of redundnant, but you can avoid invoking an
external filter if no SPAM# is present in the header.
Alternatively, you can modify the subject using formail, something like this
(untested):
:0fhw
* Subject: \[SPAM#[0-9]\] \/
| formail -I "Subject: $MATCH"
--
Klaus Johannes Rusch
KlausRusch(_at_)atmedia(_dot_)net
http://www.atmedia.net/KlausRusch/
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail