MailScanner prevents bayes mysql autolearn

Jim Creason jim at
Thu Jun 11 14:12:01 UTC 2015

Hi Antal,

This sounds like something I encountered setting this up a couple months 
ago.  I'm pretty sure my issue was this symlink in /etc/spamassassin was 
missing: -> /etc/MailScanner/spam.assassin.prefs.conf


On 6/10/15 4:20 PM, ADMX - Antal Delahaije wrote:
> Hi,
> I’ve configurerd the latest MailScanner 4.85.2 in combination with
> MailWatch 1.2.0 beta 8. Everything works fine except for bayes autolearning.
> If I set ‘SpamAssassin User State Dir =
> /var/spool/MailScanner/spamassassin’ the bayes files are written into
> this directory but it also creates a journal which always is created
> with 0600 permissions thus MailWatch cannot access this journal until I
> manually set permission to 0660. This journal merges with the bayes
> database and a new file with the same 0600 permissions is created.
> Whatever I do to this folder permissions or set in MailScanner.conf, it
> always is permission 0600.
> Then I figured out bayes can also write to MySQL database so I’ve
> configured something like below in my spam.assassin.prefs.conf.
> bayes_store_module Mail::SpamAssassin::BayesStore::MySQL
> bayes_sql_dsn      DBI:mysql:sa_bayes:
> bayes_sql_username sauser
> bayes_sql_password password
> bayes_sql_override_username postfix
> This works great for all e-mails I manually learn with ‘sa-learn –p
> /etc/MailScanner/spam.assassin.prefs.conf –-ham/--spam file’ command or
> I learn from the MailWatch frontend, no more errors here!
> After a while I noticed MailScanner said it was autolearning but still
> creating the local bayes files in ‘/var/spool/MailScanner/spamassassin’.
> I tried disabling the ‘SpamAssassin User State Dir’ but this completely
> stopped autolearning.
> I think MailScanner is somehow preventing spamassassin to autolearn via
> MySQL. Is this possible what I am doing via MailScanner? Maybe some
> misconfiguration?
> Or does anybody know the solution to get autolearn working the
> conventional way?
> Best regards,
> Antal.

Jim Creason

Chief Engineer

Shouting Ground Technologies

More information about the MailScanner mailing list