Does spamassasin actually learn something from the messages?

SYSTEM INFORMATION
Debian 12 REQUIRED
7.30.8 REQUIRED

I’ve been feeding spamassin for almost a month with spam mails. Every time it says "Learned tokens from XX message(s) (XX message(s) examined). Still get the same spam messages. Not even variations, just same texts. Does it actually learn something? Is it something else I should teach it?

What I did was to have created spam folders on my mail domains, move manually to that folders all the spam I get, and run every now an then (roughly every 3 days) the comand:
sa-learn --no-sync --spam /home/mydomain/homes/mailbox/Maildir/.spam/{cur,new}*
Each time it says it learned tokens, still the marked spam messages keep coming.

@cristianbanu,

Yes, spamassassin does learn from messages you flag as spam, or (if setup) send to

spamtrap@yourdomain.com

The process can take some time, as it’s learning.

When running “sa-learn”, make sure you are running as the “mailbox” user so that it addresses spam for that mailbox specifically.

Something like:

sudo -u {mailbox_username} sa-learn --no-sync --spam {path_to_spam_folder}/*/

Then

sudo -u {mailbox_username} sa-learn --sync

The first command does the actual spam classification, the second command applies the changes.

I have a script which runs on the server, though technically when you submit spam via Usermin or via the “spamtrap” address (if configured) it does this behind the scenes automatically.

*** On one of our managed servers, we have a script that I wrote that goes through all mailboxes, processes messages from the spam folder that is 7 days old (allowing a user to remove the message from spam if it was misclassified), then deletes the processed messages. The script proactively runs around the clock, allowing us to help SA learn a bit more (at least it appears to be learning faster and better based on our experience). Keep in mind, Virtualmin does a pretty good job of this on its own with built in functionality. ***

There are also other ways to improve spam classification, and by utilizing additional “rulesets” for spam classification.

A popular ruleset can be found at:

1 Like

Thanks, I was running the sa learn as root, probably that’s why it didn’t learn.

@cristianbanu,

I made that mistake a while back, so don’t feel bad.

One would think that root will override user settings… I understand this might not be right in a commercial environment, but in my setup is fine. I’m really curious for which account will spam assassin learn if there is no mailbox associated with root user.

@cristianbanu,

No, each mailbox maintains its own spam settings by default so your spam classification doesn’t affect mine.