Articles in this section

How to train SpamAssassin on Plesk server?

Plesk for Windows kb: how-to Plesk for Linux ABT: Group A

Applicable to:

  • Plesk for Linux
  • Plesk for Windows

Question

How to train SpamAssassin on a Plesk server?

Answer

  1. Log in to Plesk.

  2. Enable Apply individual settings to spam filtering option in Tools & Settings > Spam Filter.

  3. Go to Domains > example.com > Email Addresses > johndoe@example.com > Spam Filter.

  4. Tick the option Move spam to the Spam folder:
    Click on the screenshot below to expand
    Spam

  5. Press the OK button to apply the changes.

  6. Using webmail or mail clients, train the spam filter and improve its accuracy by moving spam messages from Inbox to Spam and non-spam messages from Spam to Inbox.

    Note: Spam training is performed on a daily basis while the Plesk daily task ( For Linux servers / For Windows servers ). In case it is required to run such a process manually, execute the command below via command-line:  

    # plesk daily ExecuteSpamtrain

    Note: All messages are automatically removed from the Spam folder after 30 days. Move all non-spam messages back to the Inbox folder after performing the Plesk daily task.

Using the sa-learn utility (For Plesk on Linux)

This article explains how SpamAssassin training works in Plesk and outlines the key differences between the standalone version and the one included with Plesk Email Security

  1. Log into the server via SSH.

  2. Place all existing spam messages for example into the spam folder of the johndoe@example.com mailbox.

  3. Run the command below to generate the antispam database:

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

  4. Copy the generated files from the step №3 from /root/.spamassassin/ to the .spamassassin folder of the required mailbox, for the example johndoe@example.com

    # cp /root/.spamassassin/* /var/qmail/mailnames/example.com/johndoe/.spamassassin/

  5.  Set the correct ownership for the copied files by executing the command below:

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

    Note: after the steps above the antispam database will be applied to johndoe@example.com mailbox.

Was this article helpful?

Comments

1 comment
Date Votes
  • Question 1: Is it required that 'Move spam to the Spam folder' be selected for SpamAssasin to auto learn?

    Our preference is rather to mark emails as '***SPAM***' at the beginning of the subject line so as to not miss false positive and then manually select 'Junk' for those email come through that are SPAM. Will this not work??

    Question 2: we're using linux. Do we also need to use the sa-learn utility?

    I marked a bunch of emails as 'Junk' in RoundCube and they appear to show up in the /our_user/Maildir/.Spam/cur directory.

    However when I run the utility it works, but nothing shows up in the /root/.spamassassin as indicated above

    root@srvr:~# sa-learn --spam /var/qmail/mailnames/mydomain.com/our_user/Maildir/.Spam/cur/
    Learned tokens from 180 message(s) (180 message(s) examined)

    [it works, I can see the perl process doing it's thing and after a bit I got the 'learned from tokens'.
    However when I list the directory below, its empty ]

    ls /root/.spamassassin

    --> Empty instead of any output??

    I don't see where the output of the 'sa-learn' process went to??

     

    0

Please sign in to leave a comment.