You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by John Nichel <jo...@kegworks.com> on 2004/07/06 22:51:39 UTC

Routing mail if SPAM

Hi,

   I currently have qmail, courier-imap, vmailmgr, and spamassassin 
running just fine, but I would like to tweak it a bit more.  What I'm 
looking to do is move all mail to a 'spam' folder on the imap server if 
spamassassin deems that it is spam.  I found a 'ifspamh' script on 
http://www.pycs.net/lateral/stories/9.html, but it will only forward to 
another account if the message is spam (and my shell scripting is way to 
weak to figure out how to change it).  I have a .qmail file setup like 
this...

|ifspamh | /usr/local/bin/maildir ./users/jnichel/.SPAM
/usr/local/bin/maildir ./users/jnichel

This doesn't work of course, because /usr/local/bin/maildir isn't a 
mailbox, but it's the logic I am wanting to do....First line, if mail is 
spam, put it in the .SPAM folder, Second line, if it is not spam, put it 
in the users inbox.

I'm sure there's a way to do this, but I can't find it.  Can someone 
point me in the right direction?  TIA

-- 
John C. Nichel
KegWorks.com
716.856.9675
john@kegworks.com

Re: Routing mail if SPAM

Posted by Ken Scott <ke...@geodax.com>.
On Tue, 2004-07-06 at 16:51, John Nichel wrote:
> Hi,
> 
>    I currently have qmail, courier-imap, vmailmgr, and spamassassin 
> running just fine, but I would like to tweak it a bit more.  What I'm 
> looking to do is move all mail to a 'spam' folder on the imap server if 
> spamassassin deems that it is spam. 

> I'm sure there's a way to do this, but I can't find it.  Can someone 
> point me in the right direction?  TIA

John, 
The script I am using is InternetSpamBeGome (isbg.py)
# This software is written and maintained by Roger Binns
# <ro...@rogerbinns.com> It is distributed under the <a
#href="http://www.opensource.org/licenses/artistic-license.php">Artistic
# License</a>.

Ken


Re: Routing mail if SPAM

Posted by Rick Macdougall <ri...@nougen.com>.

John Nichel wrote:

> Hi,
> 
>   I currently have qmail, courier-imap, vmailmgr, and spamassassin 
> running just fine, but I would like to tweak it a bit more.  What I'm 
> looking to do is move all mail to a 'spam' folder on the imap server if 
> spamassassin deems that it is spam.  I found a 'ifspamh' script on 
> http://www.pycs.net/lateral/stories/9.html, but it will only forward to 
> another account if the message is spam (and my shell scripting is way to 
> weak to figure out how to change it).  I have a .qmail file setup like 
> this...
> 
> |ifspamh | /usr/local/bin/maildir ./users/jnichel/.SPAM
> /usr/local/bin/maildir ./users/jnichel
> 
> This doesn't work of course, because /usr/local/bin/maildir isn't a 
> mailbox, but it's the logic I am wanting to do....First line, if mail is 
> spam, put it in the .SPAM folder, Second line, if it is not spam, put it 
> in the users inbox.
> 
> I'm sure there's a way to do this, but I can't find it.  Can someone 
> point me in the right direction?  TIA


Hi,

A simple maildrop script will work just fine.

for vpopmail, but it should be easily tweaked for vmailmgr

SHELL="/bin/sh"
import EXT
import HOST
VPOP="| /home/vpopmail/bin/vdelivermail '' bounce-no-mailbox"
VHOME=`/home/vpopmail/bin/vuserinfo -d $EXT@$HOST`
logfile "mailfilter.log"

if ( $VHOME eq "" )
{
    log "========"
    log "ERROR: VHOME isn't set!"
    to "$VPOP"
}
else
{
    if (/^X-Spam-Flag: *YES/)
    {
       exception {
          include $VHOME/Maildir/.mailfilter
       }

       `test -d $VHOME/Maildir/.Spam`
       if( $RETURNCODE == 1)
       {
          `maildirmake -f Spam $VHOME/Maildir`
       }
       exception {
          to "$VHOME/Maildir/.Spam/"
       }
    }

    exception {
       include $VHOME/Maildir/.mailfilter
    }

    # default delivery
    exception {
       to "$VHOME/Maildir/"
    }
}

Regards,

Rick