At 23:28 2003-05-31 -0500, Justin Shore wrote:
I can't figure out a regex way to remove all occurences of "***SPAM***"
from the Subject line. This happens when I bounce a piece of spam that
SpamAssassin has already marked up to a spamtrap address anymore. My only
fix is to check for that string twice. A regex fix for this would be
handy.
You don't remove it with a regexp per-se - you'd "capture" the content of
the Subject: line and then rewrite the subject header using formail. You
could either capture the text before spamassassin is invoked, or you could
use a $MATCH construct to match the subject-line text which occurrs after
the given blob in the subject.
Along the same lines I can't figure out how to apply that regex to
$SUBJECT that I initially match. I use it later when I forward mail to
the FTC and NANAS. Any tips on this that take into account the problem of
multiple ***SPAM*** strings would be gladly accepted.
# Extract subject and assign it to SUBJECT
:0
* ^Subject:[ ]*\/[^ ].*
{
SUBJECT=$MATCH
}
Uhm, you have the *ORIGINAL* subject, before SpamAssassin got its mitts on
it. Surely it might strike you as useful?
:0f
# Clean up the spam by removing the SA headers, Subject change
# and other misc headers.
| spamassassin -d \
| sed -e "s/^Subject: \*\*\*SPAM\*\*\*/Subject:/" \
-e "s/^Subject: \*\*\*SPAM\*\*\*/Subject:/" \
FTR, you _really_ should keep the continued pipes at an indent level past
the intial delivery pipe. All that sed stuff is unnneeded - just revise
your formail invocation:
| $FORMAIL -I ReSent \
-I X-Envelope-To: \
-I "Subject: $SUBJECT" \
-I X-Scanned-By:
As in, you've got the original pre-SA subject stored in $SUBJECT, why not
put it to good use. This eliminates an unnecessary invocation of sed.
| sed -e "s/domain1.net/spam-report-domain.com/gi" \
-e "s/aaa.bbb.ccc.14/555.555.555.555/gi" \
-e "s/aaa.bbb.ccc.12/555.555.555.555/gi" \
-e "s/domain2.net/spam-report-domain.com/gi" \
-e "s/domain3.com/spam-report-domain.com/gi" \
-e
"s/((domain1|domain2|domain3)\.com(domain4|domain5)\.net))/spam-report-domain.com/gi"
---
Sean B. Straw / Professional Software Engineering
Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
Please DO NOT carbon me on list replies. I'll get my copy from the list.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail