I had an issue where the MDaemon Mailserver’s Spam Filter was not learning new Spam or Ham. Currently running an evaluation version of MDaemon v16.0.1 but seen this before on v13, v14 and v15 :)

When people click ‘This is Spam‘ in Worldclient or forward it to the Spam address, the message is moved to a Public Folder named: Bayesian Learning\SPAM.

The file C:\MDaemon\App\LEARN.BAT is executed every midnight, unless you have a file named MY-LEARN.BAT
MDaemon Spam Filter Screenshot

To fix the Bayesian Learning, this is what I did:

  1. Spamassassin (a ported Linux Spam filter) can only handle the 8.3 Short Filename format! Since my server is a fresh formatted and installed Windows Server 2012R2, 8.3 filename format is OFF by default. To turn it on for the volume on which MDaemon is installed, open a command prompt and run: “fsutil 8dot3name set E: 0
    (I installed MDaemon on the E: drive). You can verify the setting using “fsutil 8dot3name query E:“.
  2. Now the 8.3 filenames are supported, all existing filenames and directory names won’t change. Only new ones will have an additional 8.3 name. So we need to change the “E:\MDaemon\Public Folders\” directory and the directories below:
    cd mdaemon
    fsutil file setshortname "Public Folders" "publi~1"
    cd publi~1
    fsutil file setshortname "Bayesian Learning" "bayes~1"
    cd bayes~1
    fsutil file setshortname "Spam.IMAP" "spam"
    fsutil file setshortname "Non-Spam.IMAP" "non-spam"

    You can verify the shortnames using “dir /x”

  3. Now we can finally change the C:\MDaemon\App\LEARN.BAT file. Change the directory name after –dir to the shortnames: “E:\MDaemon\publi~1\bayes~1\spam\*.msg” and “E:\MDaemon\publi~1\bayes~1\non-spam\*.msg”.
  4. Last but not least, I saw a lot of typos in the LEARN.BAT file, just remove ALL the double %% into % (I don’t know why I had double %% characters everywhere, but it should be single % )

Note1: MDaemon 16.0.1 is using Spamassassin 3.4.1, which is still not able to handle long filenames

Note2: I think you should not update the Spam Filter – Bayesian Classification GUI screen in MDaemon because it will probably overwrite your LEARN.BAT file. Best option is to copy your LEARN.BAT to a MY-LEARN.BAT file because that won’t be overwritten.