20040414 OPENWEBMAIL SPAMASSASSIN INTEGRATION PATCH:

Overview:
This patch and tar file add SpamAssassin support to OWM. This patch requires 
that Mail::SpamAssassin be installed on your system.

Having SpamAssassin available to each user is helpful because in order to use 
Bayesian filtering effectively each user should have and maintain their own 
Bayesian databases. This patch adds two buttons to the main message viewing 
page. The buttons are titled "spam" and "ham". Users can use these two buttons 
to "learn" the email in their inboxes as spam (bad email) or ham (good email). 
The more they use the learner, the better the filtering becomes. Of course,
administrators should tell users to not just learn spam. it is important to
learn ham too.

This patch also adds support to automatically move messages detected as spam to 
a folder (or delete).

This patch also adds support for SpamAssassin to use the Razor databases and 
the DNS blacklists if the system administrator allows it. Administrators can 
configure OWM with the new options in openwebmail.conf.default:

enable_spamassassin             no
sa_local_tests_only             yes
sa_network_timeout              5
sa_enable_bayesian              no
default_sa_enable               no
default_sa_score_threshhold     15
default_sa_use_bayes            no
default_sa_bayes_auto_learn     no
default_sa_use_blacklists       no
default_sa_use_razor            no
default_sa_use_dcc              no
default_sa_use_pyzor            no
default_sa_move_spam            no
default_sa_spam_destination     mail-trash

Notice that no options are enabled by default. This may change if this patch 
gets added to OWM officially.


IMPORTANT:
SpamAssassin slows down processing of a mail folder considerably. This patch is 
convenient and effective, but slow. For that reason a few things should be 
taken into consideration before activating SpamAssassin support on your OWM 
system:

1. There is a major performance hit when SpamAssassin is enabled. I tried the 
best I could to speed things up, but mabye someone can think of other ideas. If 
the speed is an issue for you, just disable spamassassin globally. If you are 
going to use this feature do yourself a favor and use SpeedyCGI with 
OWM/SpamAssassin. It's worth it. Instructions for installing SpeedyCGI are 
available in the OWM README file on the main website at 
http://www.openwebmail.com.

2. This patch was never intended to be the only line of defense in fighting 
your spam, it was intended as a tool for users to customize their spam 
detection through Bayesian learning. Although it could be your only line of 
defense, you would suffer slow system time regularly. It is HIGHLY recommended 
that you install additional spam filtering at the SMTP level of mail delivery, 
or MTA level. Vipul's Razor is an excellentstart. SpamAssassin and MIMEDefang 
are other possibilities.

3. When running with SpamAssassin support enabled in OWM it is recommended that 
you set a cron job to process mail folders on a regular basis. This will reduce 
the perceived impact of the filtering for the users when they first login to a 
session.

4. When SpamAssassin is enabled and a user enables it in their preferences a 
file will be created in each users ~user/.oenwebmail/webmail directory named 
'spamassassin_user_prefs'. This file stores all of the spamassassin 
configuration settings for that user and is mandatory.

5. When Bayesian Learning is enabled globally and by the user, three files will 
be created in the ~user/.openwebmail/webmail directory. These files are 
'bayes_toks', 'bayes_seen', and 'bayes_journal'. These files are the token 
databases required by the SpamAssassin Bayesian learner.

6. This patch does not modify emails in any way. Using SpamAssassin through the
OWM interface does NOT add an X-Spam-Score header or any other header information
to the messages. All it does is figure out the spam score and move the message
if that is requested. If move message is not requested than using this is only
good for bayesian learning and nothing more.

7. The SpamAssassin spam detection and message moving occur at the very end of
the mailfiltering process. So, any mail filters that are already in place will
continue to work exactly as expected BEFORE SpamAssassin analyzes the message.
If the message is already flagged by an OWM filter to be moved, than SpamAssassin
skips the message entirely. Any message marked as processed (Status: V) by OWM
will NOT be looked at by SpamAssassin. This ensures messages are not processed
twice and is the same method used already by the filter system.


Patches:
A single patch file and one tar file are what are required to add this 
functionality.
The tar file should be extracted at the openwebmail root directory.
The the patch should be run at the openwebmail root directory.
You can download each file below:
  1. spamassassin.patch
  2. iconsets.tgz
Alternatively, if you don't like one big fat patch you can download
all of the file patches separately in this tarball:
  1. all_patches.tgz
These patches are against the -current file timestamped:
 openwebmail-current.tgz        13-Apr-2004 21:10   5.8M


FUTURE IDEAS:
-Add spam/ham learning buttons to individual message view.
-Add whitelisting of addressbook.


Some screenshots: