Spamassassin + vpopmail + sa-learn + learning from IMAP folders

Below is a quick solution to making spamassassin learn from specific IMAP folders. Script represents a daily cron script and I just used sudo vpopmail (has to be the same as your spamd user) to simplify things. You probably should use user specific crontab…

#!/bin/bash
for F in `find /home/vpopmail/domains -type d -name '.Junk' -print`;
do sudo -H -u vpopmail /usr/bin/sa-learn --spam $F/cur/* &> /dev/null;
rm -f $F/cur/*;
done;
This entry was posted in Linux. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *