Class SpamAssassinManager

java.lang.Object
com.aoindustries.aoserv.daemon.util.BuilderThread
com.aoindustries.aoserv.daemon.email.SpamAssassinManager
All Implemented Interfaces:
TableListener, PackageManager.PackageListener, Runnable

public final class SpamAssassinManager extends BuilderThread implements Runnable
The primary purpose of the manager is to decouple the IMAP server from the SpamAssassin training. The training process is slow and makes the IMAP server hesitate in ways that interfere with the mail client and user.

The SpamAssassin manager looks for emails left in specific directories by the IMAP server. When these files are found, the SpamAssassin training command (sa-learn) is invoked on these files. The files start with either ham_ or spam_ depending on the type of messages. In order to maintain the expected behavior, the files are processed in chronological order. That way if a user drags a message to the Junk folder then back to the INBOX, it will not be considered spam.

To help avoid any race conditions, only files that are at least 1 minute old (or in the future by 1 or more minutes to handle clock changes) are considered on each pass. This gives the IMAP server at least one minute to write all of its files.

Multiple files from one user are sent to sa-learn at once when possible for efficiency.

TODO: SELinux port management for non-standard (other than 783) ports.

TODO: Somehow report when users drag from Junk to elsewhere (ham training), perhaps we can tweak our sa_discard_score some

Author:
AO Industries, Inc.