Results 1 to 2 of 2

Thread: Zarafa on synology with Spamassassin

  1. #1
    Junior Member
    Join Date
    Sep 2015

    Zarafa on synology with Spamassassin

    Hi folks,

    I've been looking arround for quite a while to finetune the Zarafa on synology experience, and one of the main missing part was a proper way to process email and sending the right stuff to junk mail.
    It's been a long journey and a lot of forum searching but in the end i beleive i have something that is quite satisfactory and just wanted to share that with you guys.
    Note that i'm not a programer and this are just stuff i picked up here and there and concatenated the various solution. So don't ask me a technical detail, but the community may help you.
    I wish i could thank all the guys who contributed to providing me the right hints and solution... but i don't know so... or too lazy for the time being.

    This setup do not requires any rootkit or any modification of the legacy synology env.
    It does not require Docker either as this is so far not reliable enough to me... for production.

    Any how here is it.

    First thing to limit spam : Enable a way to have dynamic email address so that whenever I need to fill out a form with an email, i can enter any email as long as it matches the correct pattern : this is regex base and canonical table over postfix.
    That is something that needs to be done every time mailserver is updated.

    In order to make this easy, i made a quick bash script that does all the required stuff to re-enable zarafa over postfix when the update occurs.
    Note that this script creates the pattern file that will redirect the mail to the proper email user. the pattern here is {anything}-go{the real user name}@{}
    now you can keep your real adress to yourself and give away some easy traceable email adress in the jungleweb. If a mail adress gets out there on some spam list, first you'd know who leaked it, and secound, it becomes easy to blacklist that address.

    There is the script (that work for me. you'll need to adjust the pattern)

    One this is done, restart zarafa and mail server.


    you want the spam mails to be redirected in the right folder (the junk one.) that is quite easy and lot of tutos explain the procedure.
    Here you'll have to edit a file named :

    Look for :
    And make sure that you have
    Then look for :
    And make sure that you have
    Make sure you don't have the comma "," at the end (after the Yes)

    save the file.
    Restart Zarafa.

    Now the spam learning.
    That was the tough part as synology has a very limited environment and most of the tools aren't really available.
    First, you need to enable the spam stuff from mailserver, through the main DSM GUI.

    next, the question is to process learn-sa (the learning tool for spamassasin) in the proper way.
    I figured out that the following command line work well.
    that the way to call the sa-learn. Now let get him to do his job :
    If you execute just like that, you should have the help menu.

    First is to get rid of the existing bases :
    you probably need to do that for each user as i noticed that the next script won't work if that is not done at first.

    now come piece of code that act as a webapp plugin. spamtrain.
    You can find it from the plugins area for webapp on zarafa site :
    I got it from there :

    Install it in the right place that is :
    to extract the file :
    tar xvf {name of the file}
    Then go to the spamtrain directory and there you'll have the config.php file
    That's the one to edit :

    Mine looks like that now :
    Basically, i adjusted the command line os that it reflects the specifics of synology enviroment.

    I ran into quite some trouble as the user executing the script seems to be the www-data and requires to be granted access to all items listed inthe command file.

    So far so good. restart the whole thing. make sure that your cache and plugins cache and things are empty before reloading the webapp.
    Right click on an item should provide you with 2 extra options : junk and no junk.
    This is the way to teach spamassasin that the mail is what you point it to be.
    Use this to rectify a wrongly sorted email, and over time, it gets quite good to be honest.

    So that's it.
    Hope that helps someone out there. I have no idea what i did. Just enthousiast and enjoy having my own custom made email with my own rules

    Last edited by waganene; 18-09-2015 at 04:45 PM. Reason: typo in title

  2. #2
    Junior Member
    Join Date
    Apr 2014
    Thanks for this, however I am having trouble setting the permissions for the plugin. I don't seem to have a user www-data, how did you find out which user was running the script?, and how did you grant then access. I'm still new to linux and I'm not sure the best way to grant privs to the user.
    Am I correct in thinking I will have to change ownership of the directories and files to the user? Hope you can help.

Similar Threads

  1. Zarafa on Synology DSM 5.0
    By yvi_hh in forum Zarafa on community platforms
    Replies: 50
    Last Post: 09-02-2017, 09:19 AM
  2. Replies: 1
    Last Post: 23-10-2012, 10:26 AM
  3. Zarafa on Synology
    By the-edge in forum Installation, Configuration and Maintenance
    Replies: 2
    Last Post: 07-10-2012, 10:10 PM
  4. Zarafa on Synology DS1512+
    By ADN182 in forum Installation, Configuration and Maintenance
    Replies: 1
    Last Post: 06-05-2012, 03:57 PM
  5. Spamassasin Rules
    By in forum WebAccess usage Archives
    Replies: 2
    Last Post: 08-07-2009, 08:47 AM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts