I'm new to maildrop...go easy.
I'm just trying to grab the To, From and Subject headers from
incoming email that has the string /Spam:/ in it.
When I find a match, I want to do the following:
1. Remove the leading 'Spam:' from the subject line and rewrite
the subject with the original text.
2. invoke a perl script that takes as input the From To and Subject
like this :
perl recordspam.pl $SENDER $RCPT "$NEWSUBJ"
this script takes the input and outputs an MD5 hex hash which
I then record in the mail as a header value (X-SPAMID)
Here are my problems:
-Any subject with a /'/ fails on it's way through filter
-For some reason, I can't catch the To and From addresses, every time
I write them to STDOUT or the maildrop-log file, I get empty values.
MY suspicion is that it has something to do with my assigment, but I
can't figure it out.
Here's my filter, the log entries are for diagnosis:
<code>
logfile "maildrop-log"
if (/^To:*!.*/:h)
{
SENDER=$MATCH2
log "$SENDER"
}
if (/^From:*!.*/:h)
{
RCPT=$MATCH2
log "$RCPT"
}
if (/^Subject:.*Spam:!.*!\)$/)
{
NEWSUBJ=$MATCH2
log "$SENDER - $RCPT - $NEWSUBJ\n"
SENDERESC=escape($SENDER)
RCPTESC=escape($RCPT)
NEWSUBJESC=escape($NEWSUBJ)
xfilter "reformail -i'Subject:$NEWSUBJESC'"
SPAMID=`/usr/local/bin/perl ./recordspam.pl $SENDERESC $RCPTESC "$NEWSUBJESC"`
xfilter "reformail -i'X-SPAMID: $SPAMID'"
to "Maildir/.spam"
}
</code>
Any help appreciated.
nov