Last modified April 10, 2005. 26031. Questions, comments? Email mark at rauros. Like this guide? Link to it!
I'm currently seeking anyone willing to translate this document into anything other than English. Is that person you? Anyone who translates this document will be paid with an endless supply of my thanks.
Author: Mark (mark at rauros dot net)
Special Thanks: Carlos (rockwithme.org)
Special Thanks: Mike (atomos13.com)
You're going to need to add users to the system and force created Maildirs on users.
So - add the users "ham" and "spam" to your system using your favorite method. Make sure they get home directories (I'm assuming /home/ham/ and /home/spam).
Next, you're going to need to make sure that any users added to the system will have a "Ham" and "Spam" folder they can drag and drop entries in. We're going to use soft links to do this.
Now you're faced with a certain problem: users probably don't mind other people seeing their spam, but they almost definitely don't want other people being able to look at their ham. What to do? Ahh, permissions.
Now, any user that looks inside the Ham folder from their mail reader will see an empty folder. Of course, you have the choice of setting the same permissions on the Spam folder if you desire. The next step is to subscribe the folders for users (again, I'm using a default install of Courier-IMAP to show how to do this). Use your favorite text editor and open /etc/skel/Maildir/courierimapsubscribed. Add INBOX.Spam and INBOX.Ham to the bottom of the file and save the changes.
Now, any and all users added to the system will have a public Spam/Ham folder they can move mails to in order to train the system! First, though, you need to write the script that actually trains SpamAssassin:
Save that as learnham under /usr/local/bin/. Now, make one just like it for spam (I'm sure you can figure it out) and call it learnspam. Execute these commands:
Finally, you need to make sure that the users "ham" and "spam" don't get added to qmail when you recreate the user database. Use your favorite text editor to modify /var/qmail/users/exclude (create the file, if necessary) and append
to the end of it.
Now, users can drag-and-drop Spam or Ham into the system to their heart's content, easily training the bayesian filter.