Training from a Directory of Messages
Bayes learning will normally not be enabled until at least 200 spam messages have been trained. Normally this is done automatically using the real-time learning, auto learning, or Plesk nightly training script but you may want to speed up the process by starting the training manually. You can use the /usr/bin/sa-learn command to train Warden.
To train a directory of bad messages as spam:
sa-learn -u amavis --no-sync --use-ignores --progress --spam /var/qmail/mailnames/example.com/johndoe/Maildir/.Spam/cur/
To train a directory of good messages as ham:
sa-learn -u amavis --no-sync --use-ignores --progress --ham /var/qmail/mailnames/example.com/johndoe/Maildir/cur
Sync the changes after you are done:
sa-learn -u amavis --sync
To view the current learning statistics from the command line (Statistics can also be viewed from the Warden dashboard under the Anti-spam Learning Statistics widget):
sa-learn --dump magic
Migrating Bayes training data from one server to another
Administrators can also use the sa-learn command to export Bayes data from one server and import it on another. To export the Bayes data run the following command:
sa-learn -u amavis --backup > /tmp/amavis-bayes.db
Transfer the /tmp/amavis-bayes.db file to the other server and run the sa-learn command to import the Bayes data into the Warden database (Warden must be installed first):
sa-learn -u amavis --restore /tmp/amavis-bayes.db
Note: It will likely take at least a few hours to import a large database. It takes about two hours to import a dump with 2 million tokens.