Training Apache SpamAssassin

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

  • 84 användare blev hjälpta av detta svar
Hjälpte svaret dig?

Relaterade artiklar

Add an email account to Outlook

These steps are the same whether you're adding your first email account or additional email...

Email Backups

Login in to your cPanel. Under the section JetBackup, click on Email Backups. On new page,...

Create Email Account

Login to cPanel and navigate to the cPanel’s Email Accounts interface (cPanel » Home » Email »...