procmail
[Top] [All Lists]

Re: Using Procmail to drop e-mail via Spamassassin's Rules

2010-04-28 13:49:25
On Wed, 28 Apr 2010, Charles Gregory wrote:

: On Tue, 27 Apr 2010, The Doctor wrote:
: > Right I have postfix, spamassassin and procmail working correctly.
: > Now I need to use the spamassassin score to reject inbound mail.
: 
: First thing to be clear about is that by the time mail reaches procmail you
: are NOT 'rejecting' mail. The SMTP session is closed, so all you can do is one
: of:
: 
: 1) Silently delete it. (Not a good idea)
: 2) Bounce it. (An extremely BAD idea that sends spam to forged senders)
: 3) Deliver it to a 'spamtrap' folder. (best idea)

Don't even think about 2) unless you want to be part of the problem.

: Here is my code for delivering mail to a spamtrap folder, placed in the user's
: personal RC file...
: 
: # IF spam score higher than user threshold, deliver to spamtrap.
: # Set the number of stars to the level you want to trap....
: 
: :0
: * ^X-Spam-Level: \*\*\*\*\*\*
: * ^X-Spam-Status: Yes, hits=\/[^ ]*
: {
:    [...]
: }

I've seen many examples using the X-Spam-Level: header, but here's another
approach if you want finer control by comparing against a numeric value
such as found in the X-Spam-Score: header value.  I found this, along with
some explanation of the recipe at

<http://muckadungdungfooshoyubillygoat.wordpress.com/procmail-numeric-threshold-example/>

SPAM_QUARANTINE=".IN_spam/"
SPAM_THRESHOLD=7.5

:0
*    ^X-Spam-Score:.*\/[-0-9\.]+
{
    :0:
    * $ -${SPAM_THRESHOLD}^0
    * $  ${MATCH}^0
    ${SPAM_QUARANTINE}
}

____________________________________________________________
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>