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

Overview

The autolearn=no value in the default X-Spam-Status header indicates that autolearning did not occur for a specific message. It does not indicate that the autolearning feature is disabled or malfunctioning globally. Autolearning behavior depends on internal scoring thresholds, prior learning status, and system configuration settings.

Autolearn Status Values

  • ham: The message was successfully learned as ham (non-spam).
  • spam: The message was successfully learned as spam.
  • no: Autolearning did not occur for this specific message due to threshold requirements or prior learning status.
  • disabled: Autolearning is disabled via configuration (bayes_auto_learn 0 or use_bayes 0).
  • failed: Autolearning was attempted but could not complete, typically due to database lock contention or file system issues.
  • unavailable: Autolearning did not complete for reasons not covered above, such as the message already being learned.

Why Autolearning May Not Trigger

  • Prior Learning: If a message has already been processed and learned by SpamAssassin, it will not be learned again. Subsequent scans of the same message will consistently return autolearn=no.
  • Scoring Thresholds: The internal score used to trigger autolearning differs from the final score reported in email headers. A header score that appears sufficient may not meet the internal threshold required for learning.
  • Header and Body Requirements: To auto-learn a message as spam, SpamAssassin requires a minimum of 3 points attributed to the header section and 3 points attributed to the body section. If either section falls below this requirement, autolearning will not trigger.
  • Debug Verification: To verify why autolearning did not occur for a specific message, run SpamAssassin with the -D flag. The debug output will display internal scoring calculations and explicitly state whether the message was previously learned or failed to meet threshold requirements.

Verifying Autolearn Activity in Logs

Administrators can monitor autolearning activity by searching system logs for specific status values:

// find mail autolearned as spam
zgrep autolearn=spam /var/log/maillog*

// find mail autolearned as ham
zgrep autolearn=ham /var/log/maillog*

// find mail where the specific message didn't achieve the proper threshold values and requirements to be autolearned
zgrep autolearn=no /var/log/maillog*

Troubleshooting Common Issues

  • Redis Bayes Storage Token Expiration: When using Redis for Bayes storage, the Bayes Token Time-To-Live (TTL) may be configured too low. This can cause spam entries to expire before reaching the required threshold of 200 trained messages. To resolve this, increase the Bayes Token TTL to 180d.
  • Configuration Verification: Confirm that autolearning is not explicitly disabled in your configuration by checking that bayes_auto_learn is set to a non-zero value and use_bayes is enabled.
  • autolearn
  • 0 brukere syntes dette svaret var til hjelp
Var dette svaret til hjelp?

Relaterte artikler

How can I fix the error: Host '127.0.0.1' is not allowed to connect to this MariaDB server?

Overview This article provides resolution steps for the MariaDB connection error Host...

How can I fix the error: Parse error at /etc/clamav/clamd.conf Unknown option ScanImage?

Overview The clamav-daemon.service may fail to start due to unrecognized configuration...

How can I fix the error: The domain limit of this license key has been reached?

Overview The Admin and Pro editions of Danami products enforce a maximum domain limit within the...

After upgrading from Centos 7 to AlmaLinux 8 Amavis is treating mail with low scores as spam. How can I fix this?

Overview Following an upgrade from CentOS 7 to AlmaLinux 8, Amavis may incorrectly classify...