Using the Plesk Premium Email extension, your users’ ability to make the system learn about spam and ham greatly improves. This article outlines the functionality of the anti-spam integration of Plesk Premium Email using Dovecot, SpamAssassin and its Bayes algorithms.
A Plesk installation normally uses Dovecot, Postfix, SpamAssassin and Roundcube to provide your users with a complete mail stack. There are regular tests shipped with SpamAssassin. And of course, they detect spam and mark it as such – or even move the spam out of the user’s inbox.
But what happens when it can’t detect the spam? What if we incorrectly identify the mail as spam? How do your users let the system know what’s what?
How Plesk Premium Email anti-spam integration works
Users usually recognize a message as spam, press “Mark as Junk” or “Trash” buttons, and remove it from their inbox. Naturally, we want to prevent similar messages from cluttering inboxes again and again. Therefore, we could learn from the messages marked as spam or ham.
Can we learn from users’ interactions?
Yes! Because Plesk Premium Email creates the necessary feedback loop. Dovecot works in such a way that when a mail is moved in to or out of the Spam folder, the system learns whether the message is spam or ham. If you want to learn more about this, check the low-level technology documentation here.
Here’s the main outline of anti-spam integration
When a user recognizes a message as Spam, they press the “Mark as Junk” button. This can happen in Thunderbird, Roundcube, or anywhere else for that matter. Effectively, the message is moved from whichever folder it was, into the Spam folder.
When this change happens, Dovecot gets a trigger to respond by executing a system-wide Sieve script. This Sieve script in turn pipes the message through the SpamAssassin sa-learn utility. The same applies in the opposite scenario – if a user recognizes a message in the Spam folder as not actually spam. Because moving the message out of the spam folder will also ultimately trigger sa-learn.
Anti-spam integration: Installation instructions
We implemented this functionality in the Plesk Premium Email extension for v. 16.6 and up. But the extension itself can’t install the SpamAssassin component. You need manual intervention from a Plesk system administrator.
Either ensure you install the SpamAssassin component before updating the extension. Or else, update the extension, then install the SpamAssassin component. Next, execute the following command-line. Because it will reconfigure domains and mailboxes with the Plesk Premium Email permission:
# /usr/local/psa/admin/bin/php \
-dauto_prepend_file=sdk.php \
'/usr/local/psa/admin/plib/modules/kolab/scripts/spamassassin.php'
Installing or removing SpamAssassin Component using Command Line
# /usr/local/psa/admin/sbin/autoinstaller add --components spamassassin
To remove SpamAssassin, albeit not recommended;
# /usr/local/psa/admin/sbin/autoinstaller remove --components spamassassin
Follow it up with disabling integration in the Plesk Premium Email extension;
# /usr/local/psa/admin/bin/php \
-dauto_prepend_file=sdk.php \
'/usr/local/psa/admin/plib/modules/kolab/scripts/spamassassin.php'
For more information about this integration, read our full documentation here.
What do you think of Kolab’s Anti-Spam integration using SpamAssassin and Dovecot? Let us know below.
One comment
Spamassassin itself moves spam, that was already recognized as such, to the Spam folder. That is for the user to be able to check, whether there was a false positive. Does Kolab learn these messages, already tagged as Spam, again? That would confuse and fragment every bayes db out there.