SpamAssassin's Bayesian filter learns from your email to improve spam detection accuracy. Training it with known spam and known ham (legitimate email) significantly improves filtering over time.
Bayesian training requires server access
Shared hosting customers can train SpamAssassin by moving spam to the Junk/Spam folder in webmail. The server periodically learns from these folders. For manual training at the server level, root SSH is required.
01. Manual Training (Root Access)
# Learn spam from a mailbox's spam folder
sa-learn --spam /home/username/mail/domain.com/user/Maildir/.Junk/cur/
# Learn ham (not spam) from inbox
sa-learn --ham /home/username/mail/domain.com/user/Maildir/cur/
# Check database statistics
sa-learn --dump magic
02. Automatic Learning
SpamAssassin auto-learns when configured with bayes_auto_learn 1 in /etc/mail/spamassassin/local.cf. Messages scoring very high (above bayes_auto_learn_threshold_spam, default 12.0) are automatically learned as spam. Messages scoring very low (below bayes_auto_learn_threshold_nonspam, default 0.1) are learned as ham.
To improve spam filtering on your account: move spam to your Junk/Spam folder (do not just delete it), mark legitimate emails as "Not Spam" if they land in Junk, and adjust your SpamAssassin score threshold in cPanel > Email > Spam Filters. See Greatly Reduce Spam.
Spam Getting Through?
Open a Support TicketQuick Recap
- sa-learn --spam and --ham for manual training
- Auto-learn with bayes_auto_learn in local.cf
- Shared hosting: Move spam to Junk folder to train
- 200+ messages of each type needed for Bayesian to activate
- Check with sa-learn --dump magic
Server administration · Last updated March 2026 · Browse all Server Maintenance articles
