You don't have to do anything special to spamd. I'm not terribly familiar with Exim's MDA, so hopefully someone can write an Answer specific to it. When your mail delivery agent runs, it should sent the e-mail through spamc -u $USERNAME
(modify the variable as necessary). Then take a look at the headers. If "X-Spame-Status: Yes" exists, then deliver the mail to a sub-folder of the user's Maildir.
I use maildrop
for my MDA. Configuration (in /usr/local/etc/maildroprc
) is:
if ($LOGNAME ne "")
{
xfilter "spamc -u $LOGNAME"
} else {
xfilter "spamc -u $USER"
}
if ( /^X-Spam-Status: Yes/ )
{
`test -d $DEFAULT/.Junk`
if( $RETURNCODE == 1 )
{
`maildirmake -f Junk $DEFAULT`
}
exception
{
to "$DEFAULT/.Junk"
}
}
As for the Bayesian learning, I wrote a script that cron calls every 20 minutes:
#!/bin/csh
foreach cuser (`ls /home`)
if ( -d $cuser/Maildir) then
sa-learn --dbpath /home/$cuser/.spamassassin --spam /home/$cuser/Maildir/.Junk
endif
end
And I follow that up with the following line to delete Junk that's older than 2 weeks. You don't need to clean it out, but most people never will by themselves:
find /usr/home/*/Maildir/.Junk/*/ -ctime +2w -type f -delete