procmail
[Top] [All Lists]

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

2010-04-28 12:17:15
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)

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=\/[^ ]*
{
   HITS=$MATCH
   # Modify the header with a custom [SPAM 5.3] style 'tag', and insert a
   # 'spamtrap' header. This is optional. Don't do it if SA already tags.
   :0fw
   * ^Subject: \/.*
   | formail -I"Subject: [SPAM $HITS] $MATCH" -I"X-Spamtrap: Spam Score [$HITS] 
exceeds your chosen threshold."

   # Log the filtering action. Also optional.
   :0cHh
   | /bin/echo "TRAPPED SPAM SCORE $HITS" | logger -p 'mail.info' -t spamtrap

   # I deliver all spam into /data/spamtrap, outside our quota system.
   # Symlink this folder into the user's IMAP mail directory for access
   # via squirrelmail
   :0
   /data/spamtrap/username
}


How do I get a local, not global procmail rule to acheie
and also tell procmail to look in local users .procmailrc files?
____________________________________________________________
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>