Spamassassin
Bayesian Filter
Notice: Please read the first section
First set the Variables to make this quick and easy:(replace cpanel_username_here with the cpanel account name you are working on...etc..):
CpUser=cpanel_username_here DomainDotCom=Email_account_domain EmailUser=Email_account_name
Then copy and paste the rest of this:
echo -e "\n\nThe cpanel accounts username is $CpUser\nand the email account for the bayesian filter is $EmailUser@$DomainDotCom\n\n" cd /home/$CpUser/.spamassassin/ echo "use_bayes 1" >> user_prefs echo "bayes_auto_learn 1" >> user_prefs
Make the script:
echo '#!/bin/bash' >> /home/$CpUser/.spamassassin/spamassassin.sh echo -e "\n#learning spam\n sa-learn --spam /home/$CpUser/mail/$DomainDotCom/$EmailUser/.Spam/cur\n\n#clean out the spam\n# find /home/$CpUser/mail/$DomainDotCom/$EmailUser/.Spam/cur/* -type f -maxdepth=1 -delete \n\n#learning safe mail\n sa-learn --ham /home/$CpUser/mail/$DomainDotCom/$EmailUser/.Ham/cur" >> /home/$CpUser/.spamassassin/spamassassin.sh
Change perms and add cron:
chown $CpUser. /home/$CpUser/.spamassassin/spamassassin.sh chmod +x /home/$CpUser/.spamassassin/spamassassin.sh echo "00 1 * * * /home/$CpUser/.spamassassin/spamassassin.sh" >> /var/spool/cron/$CpUser /etc/init.d/crond reload