A Plesk installation normally uses Dovecot, Postfix, SpamAssassin and Roundcube to provide your users with a complete mail stack. Regular tests shipped with SpamAssassin of course detect spam, and can mark it as such or even move the spam out of the user’s INBOX.
But what happens with the spam that goes undetected? What happens with the mail incorrectly identified as spam? How do your users let the system know what’s what?
Using Plesk Premium Email, your users’ ability to make the system learn about spam and ham greatly improves. This article outlines the functionality of integration between Plesk Premium Email, Dovecot, Spamassassin and it’s Bayes algorithms.
What it Does and How it Works
Users that recognize a message as spam press “Mark as Junk” or “Trash” buttons in their clients, removing the mail from their Inbox. Naturally, we’d like to prevent similar messages from cluttering Inboxes again and again, and could therefore learn from the messages marked as spam or ham. Can we somehow learn from the user’s interactions? Yes!
Plesk Premium Email creates the necessary feedback loop. Dovecot is configured such that when a mail is moved in to or out of the Spam folder, the message is learned as being spam or ham. If you want to learn more about how it does so, please see the underlying low-level technology documentation here.
The principle outline is as follows;
When a user recognizes a message as Spam, she presses the “Mark as Junk” button. This can happen in Thunderbird, in Roundcube, or anywhere else for that matter. Effectively, the message is moved from whichever folder it was, in to the Spam folder. When this change happens, Dovecot is triggered 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 to the inverse scenario; if a user recognizes a message in the Spam folder as not actually spam, moving the message out of the spam folder will also ultimately trigger sa-learn
.
Installation Instructions
The functionality in this article is implemented in the Plesk Premium Email extension from version 16.6 onward, but the extension itself can not install the SpamAssassin component. Manual intervention from a Plesk system administrator is required.
Either ensure the SpamAssassin component is installed before updating the extension, or update the extension and then install the SpamAssassin component.
To install the SpamAssassin component using the Command Line:
# /usr/local/psa/admin/sbin/autoinstaller add --components spamassassin
Next, executing the following command-line 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'
Removal Instructions
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'