Teaching SpamAssassin with sa-learn (works with cPanel)
Training SpamAssassin is super easy to do with `sa-learn`, but working out the best way to get all the spam emails to it can be a bit time consuming if done manually. The below line of code tells `sa-learn` to get all emails from all spam folders for all mail accounts.
/usr/local/cpanel/3rdparty/bin/sa-learn --progress --spam /home*/*/mail/*/*/.spam/*
The following figure shows the path components.
Use common home directory names 'home', 'home2', 'home3'.
/home*/*/mail/*/*/.spam/* └┬┘ Include all user folders within the home directories. Mail directory, nothing special going on here. ┌─┴─┐ /home*/*/mail/*/*/.spam/* └┬┘ Wildcard to include all domain folders. Wildcard to include all user folders. ┌┴┐ /home*/*/mail/*/*/.spam/* – Wildcard to include 'cur', 'new', 'tmp' folders. └─┬─┘ Go for spam, that's what we're here for.