Training SpamAssassin to Work with All Mail Accounts on the Server
You can manually train SpamAssassin to work with all mail accounts on the server from the command line.
To train SpamAssassin to work with all mail names on the server:
- Store spam and ham (non-spam) messages in two different folders, for example
spam_mails
andham_mails
. - Train SpamAssassin to work with one mailbox using the messages from these folders:
# cd /path/to/spam_mail/
# for message in * ; do /usr/local/psa/admin/sbin/spammng --bayes --mailname=mailname@domain.com --spam=$message ; done
# cd /path/to/ham_mail/
# for message in * ; do /usr/local/psa/admin/sbin/spammng --bayes --mailname=mailname@domain.com --ham=$message ; done
- Repeat this command for every mailbox on the server or just copy bayes bases (./domain.com/mailname/.spamassassin/bayes_*) from this mailbox to other mailboxes with the following command:
# find /var/qmail/mailnames/ -mindepth 2 -maxdepth 2 -type d -exec /bin/cp -f /var/qmail/mailnames/domain.com/mailname/.spamassassin/bayes_* {}/.spamassassin/ \;
where
domain.com
andmailname
should be replaced with the real domain name and mail name.