Create two new folders.
Train > Ham
Train > Spam
Create filder named sa-learn.sh in root folder with the following script:
#!/bin/bash
SALEARN=/usr/local/cpanel/3rdparty/bin/sa-learn
if [[ ! -f "$SALEARN" ]]; then
echo "sa-learn script does not exist, or you not have access, please contact your host for assistance."
exit 1
fi
echo "Processing SPAM folders"
# This attempts to read a list of folders from ~/.spamassassin/sa-learn--spam.conf
# and do the following:
# 1) Marks as Spam
# 2) Synchronizes the database after learning run
# 3) Expires any stale entries from the bayes databases
# 4) Upgrades the bayes_toks file to be in newer DB_File format
$SALEARN --dbpath ~/.spamassassin/bayes \
-p ~/.spamassassin/user_prefs --spam \
-f ~/.spamassassin/sa-learn--spam.conf \
--sync --force-expire --progress --mbox --import
echo "Processing HAM folders"
# This attempts to read a list of folders from ~/.spamassassin/sa-learn--ham.conf
# and do the following:
# 1) Marks as Ham
# 2) Synchronizes the database after learning run
# 3) Expires any stale entries from the bayes databases
# 4) Upgrades the bayes_toks file to be in newer DB_File format
$SALEARN --dbpath ~/.spamassassin/bayes \
-p ~/.spamassassin/user_prefs --ham \
-f ~/.spamassassin/sa-learn--ham.conf \
--sync --force-expire --progress --mbox --import
echo "Done"
Create ~/.spamassassin/sa-learn--spam.conf and add:
/home/cPanel_username/mail/yourdomain.ext/email_account/.Train.Spam/new
/home/cPanel_username/mail/yourdomain.ext/email_account/.Train.Spam/cur
Create ~/.spamassassin/sa-learn--ham.conf and add:
/home/cPanel_username/mail/yourdomain.ext/email_account/.Train.Ham/new
/home/cPanel_username/mail/yourdomain.ext/email_account/.Train.Ham/cur
Create cronjob once a day
0 0 * * * bash /home/username/sa-learn.sh