The help just shows a list of things like:
-d to delete read/learned mailboxes
but no info on how to actually use it.
Anyway, when I ran what you said above, I got the following repeated for about a minute:
bayes: cannot open bayes databases /Library/Server/Mail/Data/scanner/amavis/.spamassassin/bayes_* R/O: tie failed: Permission denied
bayes: cannot open bayes databases /Library/Server/Mail/Data/scanner/amavis/.spamassassin/bayes_* R/O: tie failed: Permission denied
bayes: cannot open bayes databases /Library/Server/Mail/Data/scanner/amavis/.spamassassin/bayes_* R/W: tie failed: Permission denied
ERROR: the Bayes learn function returned an error, please re-run with -D for more information at /Applications/Server.app/Contents/ServerRoot/usr/bin/sa-learn line 493.
Then at the end:
Learned new SPAM (junk mail)
Learning HAM...
Learned new HAM (not junk mail)
Syncing SpamAssassin Database
bayes: cannot open bayes databases /Library/Server/Mail/Data/scanner/amavis/.spamassassin/bayes_* R/O: tie failed: Permission denied
bayes: cannot open bayes databases /Library/Server/Mail/Data/scanner/amavis/.spamassassin/bayes_* R/W: tie failed: Permission denied
Displaying SpamAssassin Database Stats
bayes: cannot open bayes databases /Library/Server/Mail/Data/scanner/amavis/.spamassassin/bayes_* R/O: tie failed: Permission denied
bayes: cannot open bayes databases /Library/Server/Mail/Data/scanner/amavis/.spamassassin/bayes_* R/O: tie failed: Permission denied
ERROR: Bayes dump returned an error, please re-run with -D for more information
Done!
Output produced by spamtrainer Version 2.0.0
Then based on that last ine I tried:
sudo spamtrainer -D
Then I got:
/usr/sbin/spamtrainer: illegal option -- D
Junk Mail Training Script for OS X 10.9, 10.8
usage: [ -p mailpartition] [ -j junk_mailbox] [ -n notjunk_mailbox] [ -b filename] [ -r filename] [ -s path_to_sa-learn] [ -d ] [ -x number_of_days] [ -l] [ -c]
-p to specify a mail partition or store other than default
-d to delete read/learned mailboxes
-x to specify how old mail must be to be deleted
-j to specify the name of the mailbox containing junk
-n to specify the name of the mailbox containing good mail
-b to backup spamassassin bayes database to file
-r to restore spamassassin bayes database from file
-s to specify the path to the sa-learn program
-c to clean/purge the SpamAssassin database
-l to log bayes stats into /var/log/spamtrainer.log
-i to install/check the automatic startup item
-v to display the version of this script
-t to to use shared/top level folders instead of a user mailbox
-h to display this help message
So, I know I've got something broken in both the default and the spamtrainer usages.