spamtrainer

spamtrainer assists Mac OS X Server mail services administrators in updating and maintaining their SpamAssassin bayes database.

spamtrainer will read the designated HAM and SPAM mailboxes, update the SpamAssassin databases and delete mail that has been learned from.
It has an array of additional functions. Among them the possibility to backup/restore your bayes database and many more.
This script is written for OS X 10.8.x, 10.9.x , 10.10.x and 10.11.x with Server 2.x/3.x/4.x/5.x. A separate release is available for earlier OS X versions.

See current changelog for a complete list of fixes and additions.
Please read our FAQs as well.

spamtrainer is a free download.

 

 

74 replies
« Older Comments
  1. Ed van der Meer
    Ed van der Meer says:

    Hi,

    I have installed and isued the command : /usr/local/sbin/spamtrainer -i
    Then I ran: /usr/local/sbin/spamtrainer
    I get an message there is no folder?
    Starting spamtrainer…

    Training from user folders
    Learning SPAM…
    Learned new SPAM (junk mail)
    Either there is no mailbox called 1F21C7F0-4E19-433C-A2FA-E1CFC482E303 in the mailpartition
    or it has never been fed with mail.
    Syncing SpamAssassin Database
    Displaying SpamAssassin Database Stats
    0.000 0 2873 0 non-token data: spam
    0.000 0 68996 0 non-token data: ham
    Done!
    Output produced by spamtrainer Version 2.2.1

    I’m running 10.11.6 with server 5.1 and I have setup user junkmail and notjunkmail.
    Why is the script telling me no folder?

    Reply
      • cheem
        cheem says:

        I have a similar error. In this case, my spamtrainer is saying that there is no mailbox called A23F2247-D869-44E9-85F5-7BBA01EAB46C in the mailpartition or it has never been fed with mail, which is true… the Junkmail mailbox is A8829322-26B9-4143-857F-5E0573136445. Where do I set the correct mailbox?

        Reply
          • cheem
            cheem says:

            The problem is that spamtrainer is looking in the wrong place… the junkmail mailbox is not the one its looking for. The actual junkmail account does have spam; the notjunkmail account does have ham.

          • Athanasios Alexandrides
            Athanasios Alexandrides says:

            spamtrainer gets the UUID of the users from the system. So if the lookup for user junkmail returns a different UUID than the one you would expect, there might be a duplicate user, a typo or some other directory error. Any chance the user exists in the local directory and OD? Or maybe a user by different name used an alias junkmail?

          • cheem
            cheem says:

            No, there is no other user or alias called junkmail. Is there a setting to change to spamtrainer looks in the right place?

  2. Ed
    Ed says:

    Hi,

    I know I have multiple mails in the junkmail box. Could it be as we host more than one domain it looks for the wrong folder?

    Reply
  3. Ed
    Ed says:

    I added the notjunkmail and put some mail in it now it runs like this:
    Starting spamtrainer…

    Training from user folders
    Learning SPAM…
    Learned new SPAM (junk mail)
    Learning HAM…
    Learned new HAM (not junk mail)
    Syncing SpamAssassin Database
    Displaying SpamAssassin Database Stats
    0.000 0 2875 0 non-token data: spam
    0.000 0 69036 0 non-token data: ham
    Done!
    Output produced by spamtrainer Version 2.2.1

    This looks good?

    Reply
      • Ed
        Ed says:

        Fine, One last question.
        What happens when I only have spam in junkmail folder and none in notjunkmail?
        Will it still learn? and will it only delete the folders after when the automated script runs?
        When I run it from command line it does not delete any of the mails.
        So tomorrow morning it should be empty I guess?

        Reply
          • Ed
            Ed says:

            Cool works just fine!
            I’m curious how fast it learns and when spam will be less.
            I’ve used to block IP numbers but they change all the time so we had many spam.
            I’ll let you know how it goes and will spread the news if satisfied.

            Thanks!

          • Athanasios Alexandrides
            Athanasios Alexandrides says:

            The Bayes DB contributes to the spam scores. It is not by any means a blacklist. To reduce spam on your mail server, you will need a combination of a well trained Bayes DB, fine tuned rules and rule scores, proper amavisd settings, a couple of RBLs, DNSBLs and ideally Postgrey.

  4. Mike
    Mike says:

    Looks like spam trainer is no go on macOS 10.12.x? I had no issues with Server 5.2 on 10.11.x, then upgraded to 10.12.2 and noticed mail still in junkmail. When I run “sudo /usr/local/sbin/spamtrainer -i” I get the error: “This script can be used only on Mavericks and Mountain Lion.” When running spamassassin at the terminal, it hangs.

    Reply
  5. Almute Kraus
    Almute Kraus says:

    Hello, I have installed the newest version under Sierra and get the message: This script can be used only on Mavericks and Mountain Lion.
    What is the reason?

    Reply
  6. Eric
    Eric says:

    Hi,
    I’ve found your work really usefull, but like many other people above, Sierra broke everything.
    I was waiting an update after readings you post above, did you give up ?
    BR

    Reply
  7. Alfista
    Alfista says:

    Hi,
    is this software something like replace of that, that is in Mac OS X Server? While it should be done automatically by the system, without deleting the old mails in mailbox.

    Reply
  8. Sven
    Sven says:

    Hello Athanasios:

    Many thanks for Spamtrainer. I’ve been using it for many years and it is a great utility. Is there any chance you will be updating it to work with MacOS Sierra in the near future?

    Thanks,

    Reply
  9. Armand Welsh
    Armand Welsh says:

    I had posted a patch to make it work (again) with shared folders, and to run under Sierra. Was this ever implemented?

    Reply
« Older Comments

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *