How to train SpamAssassin

Created:

2017-05-05 09:11:24 UTC

Modified:

2017-08-08 13:28:16 UTC

0

Was this article helpful?


Have more questions?

Submit a request

How to train SpamAssassin

Question

How can SpamAssassin be trained?

Answer

There are two ways to train SpamAssassin:

  1. Manually:

    • Place all spam messages into one mailbox or a particular folder and use sa-learn.

      For example, a domain example.com with spam-collector mailbox spam@example.com. Point the path to the folder with spam to sa-learn utility:

      # sa-learn --spam /var/qmail/mailnames/example.com/spam/Maildir/.Spam/cur/
      

      sa-learn will create/update its database with the new spam information and store it in the following files:

      # ll /root/.spamassassin/
      -rw------- 1 root root 12288 May 5 14:57 bayes_seen
      -rw------- 1 root root 12288 May 5 14:57 bayes_toks
    • Сopy the above files to appropriate mail folder of each required domain and mailbox:

      # cp /root/.spamassassin/* /var/qmail/mailnames/example.com/spam/.spamassassin/
      
    • Change the ownership:

      # chown -R popuser:popuser /var/qmail/mailnames/example.com/spam/.spamassassin/*
      

    In this case each mailbox will use the same spam base.

  2. Automatically:

    • There is the utility spamtrain in Plesk which is executed during the Daily Task. spamtrain launches sa-learn for each mailbox with enabled SpamAssassin.

    In this case each mailbox will use its own spam base.

Additional information is available in our Advanced Administrator's Guide and in the official documentation: https://spamassassin.apache.org/full/3.0.x/dist/doc/sa-learn.html

Have more questions? Submit a request
Please sign in to leave a comment.