procmail
[Top] [All Lists]

RE: Base64spam documentation

2005-09-04 20:52:48

From: Louis N Proyect
Sent: Saturday, September 03, 2005 9:40 AM
[...]
Ideally, I'd like to process the message and return a 
code to procmail indicating that such a condition exists so that the 
message can be sent to /dev/null. If anybody could point me to a faq 
somewhere that dealt with running perl from within procmail, I'd 
appreciate it greatly. With perl, I feel confident that I can handle 
anything that spamassassin can't.

Something like this:

:0:
* $ ? $HOME/bin/my_perl_script_that_returns_non_zero_if_spam_is_detected
spam.mbox

Note: the use of $ above is optional.  I included it, because I wanted
the value of the HOME environment variable to be expanded.  I also didn't
dump the message into /dev/null, because in general, the determination of
what is spam is approximate, and I don't want to lose mail.  If I'm worried
about spam.mbox overflowing, I can run a cron job every day
that trims it back.

Or we can check on each delivery of spam, and cut back
the spam mailbox as needed.  For example,

SPAM_MBOX=$HOME/spam.mbox
#
# spam delivered into user's spam.mbox
#
:0
* ^X-Spam-Status: Yes
{

# Global lock file ... to protect multiple actions below.
LOCKFILE=${SPAM_MBOX}$LOCKEXT

:0 iWc
* $ ! ? test -f $SPAM_MBOX
| touch $SPAM_MBOX && chmod 640 ${SPAM_MBOX}
 
#
# If more than 200 messages, trim the first 100.
#
NMSGS=`formail -X 'From ' -s < $SPAM_MBOX | wc -l`
:0
* $ ? test $NMSGS -gt 200
{
XMSGS=`expr $NMSGS - 100`

:0 iWc
| formail +$XMSGS -s < $SPAM_MBOX > ${SPAM_MBOX}.tmp && mv -f ${SPAM_MBOX}.tmp 
${SPAM_MBOX} && chmod 640 ${SPAM_MBOX}
}

LOCKFILE  # release lock
}


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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