I'm following up on my original post. BTW, thanks for the help. The
script is working pretty well as is. I am having a few problems though.
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.
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
}
## Report spam to Pyzor, Razor, the FTC, and NANAS.
:0 BH
# Hopefully this will prevent mail loops.
* $ ! ^X-Spam-Loop: $BOUNCER
* ! ^FROM_DAEMON
{
: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:/" \
| $FORMAIL -I ReSent \
-I X-Envelope-To: \
-I X-Scanned-By:
# Report to Pyzor
# :0 Wc
# | /usr/bin/pyzor report
# Report to Razor
# :0 Wc
# | spamassassin -r
# Testing mbox
:0c:
reported
# Munge some strings
:0f
| 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/domain4.net/spam-report-domain.com/gi" \
-e "s/domain5.net/spam-report-domain.com/gi" \
-e "s/domain6.net/spam-report-domain.com/gi" \
-e "s/domain7.com/spam-report-domain.com/gi" \
-e "s/spamtrap/spam/gi" \
-e "s/userid1/userid2/gi" \
-e "s/userid3/usierd2/gi"
# | $FORMAIL -I ReSent \
# -I X-Authentication-Warning: \
# -I X-Envelope-To: \
# -I X-Scanned-By:
# Forward to the FTC and NANAS
# Also set X-No-Confirm so Bob, the NANAS Bot won't auto-ack me.
# Also add a X-Spam-Loop header to *hopefully* stop loops.
:0c
| ( cat $AUTOREPLY/this-is-spam.txt - \
| $FORMAIL -I"Subject: [email] $SUBJECT" \
-I"X-Spam-Loop: $BOUNCER" \
-I"X-No-Confirm: yes" \
-I"From: Auto-report <$BOUNCER>" ) \
| $SENDMAIL -f $BOUNCER $NANAS_ADDR $FTC_ADDR
# | $SENDMAIL -f $BOUNCER testuser(_at_)domainX(_dot_)net
# Another testing mbox
:0:
wip
}
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail