====== Ubuntu - SpamAssassin - Train SpamAssassin with Ham and Spam ======
Train with Spam.
sa-learn --showdots --mbox --spam spamfolder
----
Train with Ham.
sa-learn --showdots --mbox --ham hamfolder
**NOTE:** SpamAssassin needs at least 200 Ham and Spam message before it becomes fully trained. Everything above just makes it "safer" as in "more valid" or "accurate". With auto-learning these numbers will increase over time and also decrease as statistics of old mails will be dropped over time.
----
===== Automate learning =====
This learning can be automated by:
* Create a dedicated email account for Spam and another dedicated account for Ham.
* When a user receives any Spam they should forward this onto the inbox of the Spam email account.
* Users can also copy non-spam email to the inbox of the Ham email account.
* Run a cron job to train against the Spam in the Spam email account.
The script for the Spam can be something like:
/usr/bin/sa-learn -u --spam /home/domain//Maildir/./cur/
/usr/bin/find /home/domain/homes//Maildir/./cur/ -mtime+28 -exec rm {} \;
**WARNING:** Do not have the and point to account of an actual user.
This should instead point to the the email account that holds the spam.
Have ham learning be done as:
/usr/bin/sa-learn -u --ham /home/domain//Maildir/./cur/
**WARNING:** Do not have the and point to account of an actual user.
This should instead point to the the email account that holds the Ham.