Why isn't autolearning working for me (autolearn=no) ?

Lots of people seem to be confused by the "autolearn=no" statement in the default X-Spam-Status header. There are usually questions regarding whether or not "no" means SpamAssassin is not autolearning at all. What it actually means is that the specific message which includes the "autolearn=no" part was not autolearned, not that autolearning is disabled or somehow broken.

The three values that can be displayed are "no" (autolearning did not occur), "ham" (the message was learned as ham), and "spam" (the message was learned as spam).

If a message has already been learned by SpamAssassin, then that message will not be learned again. Therefore, if you run a message through SpamAssassin to see why it was classified as spam or ham, and it has already been learned, you will always get the result "autolearn=no". (To see this more clearly, use the "-D" flag, and you will see debug output explaining that the message has already been learned.)

Furthermore, the score used to trigger autolearning is somewhat different than the one reported in the final score; therefore a score displayed in the headers that ostensibly should trigger autolearning will not do so. Again, use the "-D" flag to SpamAssassin, and you will see the score that is used to determine whether or not autolearning will be triggered.

Finally, SpamAssassin requires at least 3 points from the header and 3 points from the body, to auto-learn as spam. If either section contributes fewer points, the message will not be auto-learned.

Possible Autolearn States

ham: the message was learned as ham (non-spam)
spam: the message was learned as spam
no: the specific message didn't achieve the proper threshold values and requirements to be learned
disabled: the configuration specifies bayes_auto_learn 0 or use_bayes 0 and so no autolearning is attempted
failed: autolearning was attempted, but couldn't complete. This happens if SpamAssassin can't gain a lock on the Bayes database files, etc.
unavailable: autolearning not completed for any reason not covered above. It could be the message was already learned.

Reasons why Autolearn isn't Working

1. In order for autolearn to work you need at least 200 trained messages in the ham and spam category.
2. If using Redis Bayes storage your Bayes Token TTL might be too low so the spam entries expire before they reach the 200 trained messages threshhold. Try raising the Bayes Token TTL to 180d

  • autolearn
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How can I view what SpamAssassin rules were matched by a message?

Go to Warden -> Settings -> Filter Settings and change the Log template option from short...

How can I reset and regenerate the mail statistics for the server?

You can reset and regenerate the statistics for all domains and mailboxes using the following...

How can I disable Amavis bad header tests?

By default mail with bad headers is quarantined for review but are still delivered to the users...

How do I allow or deny certain attachments with Amavis?

In Amavis banned attachments are controlled by the $banned_filename_re option in the Amavis...

How can I disable the ***UNCHECKED*** tag that Amavis applies to a message when an email is not able to be scanned?

Amavis will prepend to Subject (for local recipients only) if mail could not be decoded or...