I tried to bring up the Webapp spam integration plugin together with Spamassassin and Amavis.
The setup is: Amavis is called by Postfix, and thus Spamassassin is called by Amavis if needed. If in the end a mial is marked as spam it is moved to the junk folder dagent.
To improve the spam filter I added the Webapp spam integration plugin, and configured it as:
The dbpath is altered due to the fact that amavis has its own path and database for that.
define('PLUGIN_SPAMTRAIN_TRAIN_SPAM_CMD', '/usr/bin/sa-learn -D --mbox --spam --dbpath /var/spool/amavisd/.spamassassin/');
define('PLUGIN_SPAMTRAIN_TRAIN_HAM_CMD', '/usr/bin/sa-learn -D --mbox --ham --dbpath /var/spool/amavisd/.spamassassin/');
This looks good:
But the bayes tokens do not change, the message is not learned! There are no new tokes added to the Bayes DB.
DEBUG: Command '/usr/bin/sa-learn -D --spam --mbox --dbpath /var/spool/amavisd/.spamassassin/' finished with status 0
DEBUG: Deleting message...
DEBUG: Message deleted
DEBUG: exit::trainspam (result=true)
To further analyze the problem I extraceted the mail from the /tmp/ spamtrain-log and fed it to sa-learn manually:
There I realized that I have to omit the --mobx, because the message would not have been detected correctly.
cat spammessge.txt|/usr/bin/sa-learn --spam --dbpath /var/spool/amavisd/.spamassassin
Learned tokens from 1 message(s) (1 message(s) examined)
Given that, I changed the plugin configuration and removed the --mbox. However, that resulted in:
(Taken from /tmp/spamtrain.log)
ERROR: Command '/usr/bin/sa-learn -D --spam --dbpath /var/spool/amavisd/.spamassassin/' finished with status 13
DEBUG: exit::trainspam (result=false)
So I do wonder: is the message transformed into mbox before it is fed to sa-learn? And if so, what is wrong with the plugin, because nothing is learned?