On 10/28/2005 05:33 PM, Michael D Schleif wrote:
* On 2005:10:27:18:51:52-0500 I, Michael D Schleif <[EMAIL PROTECTED]>, scribed:
<snip />

With simscan, we are bouncing spam above a certain spamassassin
spam-count (e.g., 10).  The balance are passed on, as expected.

We want to take those that score between 5 and 10, and place them in a
designated SPAM folder for each recipient.

How should we do this?

I am comfortable with procmail recipe making; although, I have _not_
used procmail in conjunction with qmail, nor the toaster.  So, I am not
clear how to filter messages; nor how to deposit them into
recipient-specific folders.

Please, any ideas, pointers, reference will be greatly appreciated.  I
don't understand how to get procmail/maildrop/&c. to deposit the
messages into a specified directory inside a recipient's maildir?  Will
procmail create the directory when it does not exist?

What do you think?


You could use the following maildrop rules to do what you're trying to accomplish. These came from an old FreeBSD toaster maildrop script originally written by Matt Simerson.

################
SHELL="/bin/sh"
import EXT
import HOST
VHOME=`pwd`

if (/X-Spam-Status: Yes, (hits|score)=![0-9]+\.[0-9]+! /:h) {
   # Test for the existence of a Spam subfolder
   `test -d $VHOME/Maildir/.Spam`
   if( $RETURNCODE == 1 ) {
      # Spam subfolder doesn't exist.  Create it and subscribe to it.
       `maildirmake -f Spam $VHOME/Maildir`
       `/usr/local/sbin/subscribeIMAP.sh Spam $VHOME`
   }

   # Look for the deliverquota binary
   `test -x /usr/local/bin/deliverquota`
   if ( $RETURNCODE == 1 ) {
       exception {
# Deliverquota binary not found. Deliver spam to Spam folder without checking quota.
           to "$VHOME/Maildir/.Spam"
       }
   } else {
       exception {
# Deliver the spam while making sure the account isn't over quota
           xfilter "/usr/local/bin/deliverquota -w 90 $VHOME/Maildir/.Spam"
       }

       if ( $RETURNCODE == 0 ) {
           # Everything delivered just fine
           EXITCODE=0
           exit
       } else {
           if( $RETURNCODE == 77) {
               to "|/var/qmail/bin/bouncesaying '[EMAIL PROTECTED] is over 
quota'"
           } else {
               to "$VHOME/Maildir/.Spam"
           }
       }
   }
}
################

Put those rules in a text file (/etc/mail/mailfilter in this example) and add the following line to your email account's .qmail file (~vpopmail/domains/helices.org/mds/.qmail):

| /usr/local/bin/maildrop /etc/mail/mailfilter

That should do it.

Adam

Reply via email to