SpamAssassin is one of the methods used on our servers to reduce the amount of spam received. It automatically learns the type of messages you receive to improve filtering accuracy, however in some situations additional training may be beneficial. This method only works if you use IMAP and/or Webmail, as it relies on your ability to move emails to different folders.
The configuration process consists of three steps:
- Create a new folder named "spam" in your email client or webmail interface
- Create a cronjob using one of the following commands, we recommend running it once a day
- Ensure the "spam" folder is available in your email client
Training from one address from one domain:
sa-learn -p ~/.spamassassin/user_prefs --spam ~/mail/$domain.tld/$mailbox/.spam/{cur,new} >/dev/null 2>&1
sa-learn -p ~/.spamassassin/user_prefs --ham ~/mail/$domain.tld/$mailbox/{cur,new} >/dev/null 2>&1
Training all addresses from one domain:
sa-learn -p ~/.spamassassin/user_prefs --spam ~/mail/$domain.tld/*/.spam/{cur,new} >/dev/null 2>&1
sa-learn -p ~/.spamassassin/user_prefs --ham ~/mail/$domain.tld/*/{cur,new} >/dev/null 2>&1Training all addresses from all domains:
sa-learn -p ~/.spamassassin/user_prefs --spam ~/mail/*/*/.spam/{cur,new} >/dev/null 2>&1
sa-learn -p ~/.spamassassin/user_prefs --ham ~/mail/*/*/{cur,new} >/dev/null 2>&1
If you would prefer SpamAssassin learn from custom folders instead of the inbox and spam folder, you can update the command to use custom folders. The commands are case sensitive, so if you create a folder as Good then you must specify it as .Good in your command.
Training one address from one domain using custom folders (good & junk)
sa-learn -p ~/.spamassassin/user_prefs --spam ~/mail/$domain.tld/$mailbox/.junk/{cur,new} >/dev/null 2>&1
sa-learn -p ~/.spamassassin/user_prefs --ham ~/mail/$domain.tld/$mailbox/.good/{cur,new} >/dev/null 2>&1