# procmail + spamassassin issue

## SyKnight

Here's what I'm using for the .mailfilter in ~vpopmail/domains/domain.com/user

```

import EXT 

import HOST 

import HOME 

VERBOSE=1 

logfile "/var/log/maildrop-filter-log" 

SHELL="/bin/sh" 

VHOME=`/var/vpopmail/bin/vuserinfo -d $EXT@$HOST` 

VDOMHOME=`/var/vpopmail/bin/vdominfo -d $HOST` 

VPOP=`cat $VDOMHOME/.qmail-default` 

if ((/^X-Spam-Status:.*YES/)) 

{ 

   `test -d $VHOME/Maildir/.Spam` 

   if( $RETURNCODE == 1 ) 

   { 

   `/usr/bin/maildirmake $VHOME/Maildir/.Spam;chown -R vpopmail.vpopmail $VHOME/Maildir/.Spam` 

   `echo "INBOX.Spam" >> $VHOME/Maildir/courierimapsubscribed` 

   } 

   to "$VHOME/Maildir/.Spam/" 

} 

to "$VHOME/Maildir/"

```

Basically this was posted by a kind user in another thread on this forum, and modified so it doesn't throw anything to /dev/null.

In any case, this was working fine until I started using bayes. When I get an email that looks like this:

```
X-Spam-Status: No, hits=-4.8 required=5.0 tests=BAYES_00,HTML_MESSAGE 

   autolearn=ham version=2.60

```

It doesn't modify the email (mark subject with [SPAM], and put the original message in an attachment), but it throws it in .Spam instead of the inbox. I'm not sure why, since it shouldn't be matching, because it delivered this one properly

```
X-Spam-Status: No, hits=-2.2 required=5.0 tests=BAYES_00,FORGED_MUA_OUTLOOK,

   HTML_MESSAGE autolearn=no version=2.60

```

The only different is one has autolearn=ham, and the other has autolearn=no... So needless to say, I'm extremely confused.

Can anyone help me out?

TIA

----------

## c0bblers

OK, I'm not the best with expressions but I think I've found the problem.

```

/^X-Spam-Status:.*YES/)

```

Will look for anything that starts with "X-Spam-Status: " and has an unspecified number of unspecified characters followed by YES.  Since in the bayesian learning header has:

```

X-Spam-Status: No, hits=-4.8 required=5.0 tests=BAYES_00,HTML_MESSAGE

   autolearn=ham version=2.60 

```

If you notice you have 'YES' in 'BAYES' so the mail will be matched as spam.......

Cheers,

James

[/code]

----------

## c0bblers

Hi,

BTW I think thats maildrop rather than procmail, I use procmail with spamassassin and its much less complex.  Anyway, I think (but don't quote me on it) that you just need to change the one line.  In procmail I use:

 *Quote:*   

> 
> 
> ^X-Spam-Status: Yes
> 
> 

 

as the expression so you should be able to change

 *Quote:*   

> 
> 
> ((/^X-Spam-Status:.*YES/))
> 
> to
> ...

 

In fact, the original would probably never have worked properly since the yes is always 'Yes' in spamassassin as far as I know......

Cheers,

James

----------

## SyKnight

Oh you are right, It's maildrop. Sorry, these nicotine patches are making my brain a tad fuzzed this morning.

I'll give the suggestions a try and see if they work.

Thanks again!

----------

## mleck

Hey, I think you two are talking about exactly what I am hoping to do. I am running QMAIL/SPAMASSASSIN/VPOPMAIL/CLAMAV, etc... on my gentoo box, and want to set it up so that any messages that are filtered as "SPAM" go to a "SPAM" folder in their account. 

It seems like you have that working. Can you tell me how to set that up on my system please?   :Embarassed: 

Thanks heaps!

----------

## pjp

Moved from Other Things Gentoo

----------

