[Spambayes] sb_imapfilter.py not adding headers / moving messages

Tony Meyer tameyer at ihug.co.nz
Sat Apr 24 23:36:34 EDT 2004


> But, when classifying, the output will say for example:
> 
> Classified 0 ham, 1 spam, and 0 unsure.
> 
> The message was actually spam, so that's fine - but it
> left it in the inbox, and didn't add a classification
> or score header (I've turned those options on). So
> while the classification is picking the right option,
> it's not doing anything with the messages. The message
> remains in the original folder, regardless of it's
> classification, and only gets the X-Spambayes-Mailid
> header.

This is strange.  Nothing's going wrong in the IMAP conversation, so the
probably is either in the configuration or in imapfilter itself.  It seems
that it's choosing to write the filtered message to the INBOX folder,
although that doesn't explain why there isn't a classification/score header.
There isn't a "X-SpamBayes-Exception" header, is there?

The code that handles this is around line 700 of sb_imapfilter.py.  Could
you add in a line that says "print cls, spamfolder.name" after the line that
says "cls = msg.GetClassification()" and see what gets printed out?

> I also noticed a minor problem with the training as
> well, but since the messages are being moved to the
> proper folder, and the tokens are being added to the
> training database properly, I'm not concerned about it.
> I've set include_trained to True, so it should be
> adding a header to indicate it's trained on that
> message - but it doesn't.

Imapfilter doesn't use the include_trained header.  IIRC, only mboxtrain
does.  It isn't needed, because imapfilter tracks the messages in the
message info database.

> In fact, when it moves the
> message to the move_trained_*_to_folder folder, even
> the X-Spambayes-Mailid is gone.

I hadn't noticed this :)  It's a bug - basically, all spambayes headers are
removed from the message prior to training (to avoid contamination), and
then the messages gets moved/saved after that, so the headers are gone.
I've checked in a fix for this, though it shouldn't really make much
difference to anything.

> (as I understand it, it's
> supposed to create a second copy of the message with
> the new headers, and delete the original).

Yes, that's correct.

=Tony Meyer

---
Please always include the list (spambayes at python.org) in your replies
(reply-all), and please don't send me personal mail about SpamBayes. This
way, you get everyone's help, and avoid a lack of replies when I'm busy.




More information about the Spambayes mailing list