SpamAssassin doesn’t appear to be ‘learning’ from forwarded examples of spam

emailpostfixspamspamassassin

I have spamtrap@ and hamtrap@ addresses set up on my mail server and forward examples of spam to the spamtrap address. I was hoping that after a few examples, SpamAssassin would 'learn' to identify the particular characteristics of spammy mail with common attributes, but this doesn't appear to be the case – it still gets delivered as normal mail.

For example, some emails from the same sender and/ or with the same subject line, despite being sent several times to spamtrap@, are just delivered normally.

Does it sound like SpamAssassin isn't working or correctly configured, or have I misunderstood a fundamental aspect of how it works?

Best Answer

Spamassassin uses a number of rules to decide if an email is blocked and creates a score of each email. This is normally included in the header of each email, so you can see which rules have trigged.

The Spamassassin training improves the Bayesian spam testing, so if the training is working you should see the following appear

X-Spam-Status: Yes/No, score=X.X required=5.0 tests=BAYES_99...... autolearn=no 

The BAYES_99 score means the email has spam probability is 99 to 100%, however you can get BAYES_00 to BAYES_99.

If you can't see the above line in any emails, then Spamassassin is not working.

On my Virtualmin setup i've changed to having a spam folder that i move emails to and then there is a daily job that runs the Spamassassing training and after 4 weeks deletes the email.

I currently setup the script for each user with the following:

/usr/bin/sa-learn -u <username> --spam /home/domain/homes/<user>/Maildir/.<folder name>/cur/  
/usr/bin/find /home/domain/homes/<user>/Maildir/.<folder name>/cur/ -mtime+28 -exec rm {} \;
Related Topic