CRM114 is installed using the Debian package for Etch. I loosely followed the instructions in /usr/share/doc/crm114/CRM114_Mailfilter_HOWTO.txt.gz after the installation, as follows:
I edited mailfilter.mfp and changed the secret password. I edited rewrites.mfp to set my personal e-mail addresses, mail servers, mail names, etc, and I edited priolist.mfp mostly to just comment everything out, for the time being. Note that there's no whitelist/blacklist there because I'm going to use mailreaver, which is newer than mailfilter.
Running mailreaver from Procmail
I went into my IMAP client and created a "CRM" folder and several folders under that called "Spam", "NewSpam", "TrainingHam", "Unsure" and "Trained". Once they were created, I went onto the server and found the directories that were being used. In my case they were "$MAILDIR/.CRM.Spam/cur" and variations, so I added the following stanza into my .procmailrc:
Firstly, I added another rule so that anything with a subject starting 'UNS: ' gets moved to the 'Unsure' mailbox. Then I was ready to start moving stuff by hand from 'Unsure' either to 'NewSpam' (for spam) or 'TrainingHam' for things that aren't spam. I deliberately chose the names to be distinctively different to make it easier to differentiate them.
Finally I wrote the following very short shell script, which I will run from cron every ten minutes for a while, and probably reduce to every few hours later:
#!/bin/bash
for SPAM in Maildir/.CRM.NewSpam/cur/*; do
[ ! -f "${SPAM}" ] && break
/usr/bin/crm -u /home/andrew --spam /usr/share/crm114/mailreaver.crm <"${SPAM}" >/dev/null
mv "${SPAM}" Maildir/.CRM.Spam/cur
done
for HAM in Maildir/.CRM.TrainingHam/cur/*; do
[ ! -f "${HAM}" ] && break
/usr/bin/crm -u /home/andrew --good /usr/share/crm114/mailreaver.crm <"${HAM}" >/dev/null
mv "${HAM}" Maildir/.CRM.Trained/cur
done
Training
The first ten or so messages all came through as 'Unsure', as you would expect, and I moved them into the NewSpam and TrainingHam folders as appropriate. Pretty soon after that the first mail started getting identified one way or the other, and it just got better and better.
My CRM114 Installation
CRM114 is installed using the Debian package for Etch. I loosely followed the instructions in /usr/share/doc/crm114/CRM114_Mailfilter_HOWTO.txt.gz after the installation, as follows:
Creating the Initial Files
mkdir crm
cd crm
cssutil -b -r spam.css
cssutil -b -r nonspam.css
cp /usr/share/doc/crm114/examples/mailfilter.mfp .
cp /usr/share/doc/crm114/examples/rewrites.mfp .
cp /usr/share/doc/crm114/examples/priolist.mfp .
I edited mailfilter.mfp and changed the secret password. I edited rewrites.mfp to set my personal e-mail addresses, mail servers, mail names, etc, and I edited priolist.mfp mostly to just comment everything out, for the time being. Note that there's no whitelist/blacklist there because I'm going to use mailreaver, which is newer than mailfilter.
Running mailreaver from Procmail
I went into my IMAP client and created a "CRM" folder and several folders under that called "Spam", "NewSpam", "TrainingHam", "Unsure" and "Trained". Once they were created, I went onto the server and found the directories that were being used. In my case they were "$MAILDIR/.CRM.Spam/cur" and variations, so I added the following stanza into my .procmailrc:
# Run CRM114 mailreaver
:0fw: .msgid.lock
| /usr/bin/crm -u /home/andrew /usr/share/crm114/mailreaver.crm
:0:
* ^X-CRM114-Status: SPAM.*
$MAILDIR/.CRM.Spam/new
A script in cron
Firstly, I added another rule so that anything with a subject starting 'UNS: ' gets moved to the 'Unsure' mailbox. Then I was ready to start moving stuff by hand from 'Unsure' either to 'NewSpam' (for spam) or 'TrainingHam' for things that aren't spam. I deliberately chose the names to be distinctively different to make it easier to differentiate them.
Finally I wrote the following very short shell script, which I will run from cron every ten minutes for a while, and probably reduce to every few hours later:
#!/bin/bash
for SPAM in Maildir/.CRM.NewSpam/cur/*; do
[ ! -f "${SPAM}" ] && break
/usr/bin/crm -u /home/andrew --spam /usr/share/crm114/mailreaver.crm <"${SPAM}" >/dev/null
mv "${SPAM}" Maildir/.CRM.Spam/cur
done
for HAM in Maildir/.CRM.TrainingHam/cur/*; do
[ ! -f "${HAM}" ] && break
/usr/bin/crm -u /home/andrew --good /usr/share/crm114/mailreaver.crm <"${HAM}" >/dev/null
mv "${HAM}" Maildir/.CRM.Trained/cur
done
Training
The first ten or so messages all came through as 'Unsure', as you would expect, and I moved them into the NewSpam and TrainingHam folders as appropriate. Pretty soon after that the first mail started getting identified one way or the other, and it just got better and better.