Adapt bayesian filters for spam on server
Written by ⓘⓓⓔⓝⓣⓛⓤⓓ - -

One way to do that is to write a simple script that could be run manually or through a crontab entry :
#!/usr/bin/env bash
basedir=Maildir
ls -d $basedir/.* | while read dir
do
processedPart=$(basename "$dir")
if [ "$processedPart" != "." -a "$processedPart" != ".." ]
then
echo -n Processing $processedPart ...
if [ "$processedPart" == ".Spam" -o "$processedPart" == ".Pourriels" ]
then
echo as SPAM
sa-learn --spam "$basedir/$processedPart/{cur,new}"
else
echo as ham
sa-learn --ham "$basedir/$processedPart/{cur,new}"
fi
fi
done
Of course ".Spam" and ".Pourriels" ara my own choices for IMAP folders to contain spam. Update this script with your own preferences.
I have placed this script in a "spam" file in ~/bin to run it manually.