Cannot resync Spam folder (Mailfiter) files on mailserver

Discussion in 'ISPConfig 3 Priority Support' started by radim_h, Oct 22, 2017.

  1. radim_h

    radim_h Member HowtoForge Supporter

    Hello,
    i need to resync Spamfilter settings (had different Spam folder name than "Junk" until now). and replace /var/vmail/domain.tld/user/.sieve files with softlink to /var/vmail/domain.tld/user/sieve/ispconfig.sieve as mailboxes works in recent ISPC

    When i go to menu Email -> Emal Mailbox ->Mailfiter, uncheck "Move Spam Emails to Junk directory." and then check it again it gets changed as described above. But i have couple hunderd mailboxes, don't want to click each of those

    So i go to database to main server do UPDATE `mail_user` SET `move_junk` = 'n'; then resync Maildomains,Mailboxes,Fetchmail, Mailfilter /to be sure .) / then UPDATE `mail_user` SET `move_junk` = 'y' and resync all again.
    But nothing gets changed. Is it supposed to change filters this way?
    If yes, cannot be problem caused by this weird thing that ISPC offers me 4 server to sync mailfiters, as here https://www.dropbox.com/s/ckvyx399emgmwga/Screenshot 2017-10-22 23.08.58.png?dl=0 ? btw: i have synced all of them .o]
    Sorry for my constant troubles, but my instalaltion is bit old, since first release of ISPC3...

    Regards
    RH
     
  2. florian030

    florian030 Well-Known Member HowtoForge Supporter

    setting move_junk = y in the database will not update / create the mailfilter (sieve-script) which is used to move the mail.
     
  3. radim_h

    radim_h Member HowtoForge Supporter

    so i have to disable/enable for 700 mailboxes manually ? :( no different sollution ?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    The only other way might be to trick ISPConfig and change some code. The code that writes the .sieve file is in /usr/local/ispconfig/server/plugins-avaialble/maildrop_plugin.inc.php.

    Around line 175 (in the current ISPConfig version) you find these lines:

    Code:
    // Write the custom mailfilter script, if mailfilter recipe has changed
            if($data["old"]["custom_mailfilter"] != $data["new"]["custom_mailfilter"]
                or $data["old"]["move_junk"] != $data["new"]["move_junk"]
                or $data["old"]["cc"] != $data["new"]["cc"]) {
    
    replace them with:

    Code:
    // Write the custom mailfilter script, if mailfilter recipe has changed
            if($data["new"]["move_junk"] == 'y') {
    
    Now run a resync and then change the file back to the original code.
     
  5. radim_h

    radim_h Member HowtoForge Supporter

    HEelo,
    i was out for couple days. Do i have to do it on master server or mailserver ?
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    On the mail server.
     
  7. radim_h

    radim_h Member HowtoForge Supporter

    just running sync doesnt seem to work
    or do i have to set database
    UPDATE `mail_user` SET `move_junk` = 'n'
    resync (with original or new code?)
    UPDATE `mail_user` SET `move_junk` = 'y'
    resync ?

    EDIT: also did not help
     
    Last edited: Oct 25, 2017
  8. radim_h

    radim_h Member HowtoForge Supporter

    funny thing is. that maildrop plugin is probably not enabled, those are my enabled plugins on mailserver

    root@mail:/usr/local/ispconfig/server/plugins-enabled# ls -la
    total 68
    drwxr-x--- 2 root root 4096 Nov 8 2016 .
    drwxr-x--- 14 root root 4096 Sep 1 05:00 ..
    lrwxrwxrwx 1 root root 71 Mar 28 2011 apps_vhost_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/apps_vhost_plugin.inc.php
    lrwxrwxrwx 1 root root 67 Apr 4 2013 backup_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/backup_plugin.inc.php
    -rwxr-x--- 1 root root 45 Oct 3 18:39 empty.dir
    lrwxrwxrwx 1 root root 69 Mar 28 2011 firewall_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/firewall_plugin.inc.php
    lrwxrwxrwx 1 root root 68 Mar 28 2011 getmail_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/getmail_plugin.inc.php
    lrwxrwxrwx 1 root root 72 Mar 28 2011 maildeliver_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/maildeliver_plugin.inc.php
    lrwxrwxrwx 1 root root 68 Nov 27 2011 mailman_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/mailman_plugin.inc.php
    lrwxrwxrwx 1 root root 70 Nov 8 2016 mail_plugin_dkim.inc.php -> /usr/local/ispconfig/server/plugins-available/mail_plugin_dkim.inc.php
    lrwxrwxrwx 1 root root 65 Mar 28 2011 mail_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/mail_plugin.inc.php
    lrwxrwxrwx 1 root root 75 Mar 28 2011 mysql_clientdb_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/mysql_clientdb_plugin.inc.php
    lrwxrwxrwx 1 root root 77 Mar 28 2011 network_settings_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/network_settings_plugin.inc.php
    lrwxrwxrwx 1 root root 75 Mar 28 2011 postfix_filter_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/postfix_filter_plugin.inc.php
    lrwxrwxrwx 1 root root 75 Mar 28 2011 postfix_server_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/postfix_server_plugin.inc.php
    lrwxrwxrwx 1 root root 76 Mar 28 2011 software_update_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/software_update_plugin.inc.php
    lrwxrwxrwx 1 root root 65 Nov 8 2016 xmpp_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/xmpp_plugin.inc.php



    but its not enabled also on fresh ISPC install

    root@template:/usr/local/ispconfig/server/plugins-enabled# ls -la | grep mail
    lrwxrwxrwx 1 root root 68 Aug 4 14:08 getmail_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/getmail_plugin.inc.php
    lrwxrwxrwx 1 root root 72 Aug 4 14:08 maildeliver_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/maildeliver_plugin.inc.php
    lrwxrwxrwx 1 root root 68 Aug 4 14:08 mailman_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/mailman_plugin.inc.php
    lrwxrwxrwx 1 root root 70 Aug 4 14:08 mail_plugin_dkim.inc.php -> /usr/local/ispconfig/server/plugins-available/mail_plugin_dkim.inc.php
    lrwxrwxrwx 1 root root 65 Aug 4 14:08 mail_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/mail_plugin.inc.php
     
    Last edited: Oct 25, 2017
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    Does the server run courier imap or dovecot imap?
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    I see where my error is, I told you to edit the file for courier and not dovecot. sorry.

    Edit this file instead,
    /usr/local/ispconfig/server/plugins-available/maildeliver_plugin.inc.php
    around line 86 you find this:

    Code:
    // Write the custom mailfilter script, if mailfilter recipe has changed
            if($data["old"]["custom_mailfilter"] != $data["new"]["custom_mailfilter"]
                or $data["old"]["move_junk"] != $data["new"]["move_junk"]
                or $data["old"]["autoresponder_subject"] != $data["new"]["autoresponder_subject"]
                or $data["old"]["autoresponder_text"] != $data["new"]["autoresponder_text"]
                or $data["old"]["autoresponder"] != $data["new"]["autoresponder"]
                or (isset($data["new"]["email"]) and $data["old"]["email"] != $data["new"]["email"])
                or $data["old"]["autoresponder_start_date"] != $data["new"]["autoresponder_start_date"]
                or $data["old"]["autoresponder_end_date"] != $data["new"]["autoresponder_end_date"]
                or $data["old"]["cc"] != $data["new"]["cc"]
            ) {
    
    replace that with:

    Code:
    // Write the custom mailfilter script, if mailfilter recipe has changed
    if($data["new"]["move_junk"] == 'y') {
    
     
  11. radim_h

    radim_h Member HowtoForge Supporter

    Hello, is Debian8 + dovecot
     
  12. till

    till Super Moderator Staff Member ISPConfig Developer

    Then my new post #10 should work.
     
  13. radim_h

    radim_h Member HowtoForge Supporter

    one more question , sorry it doesnt work just with script change & sync.

    do i have to UPDATE `mail_user` SET `move_junk` = 'n' / UPDATE `mail_user` SET `move_junk` = 'y' ? if so on which server, master or mailserver ? i'm not sure how the changes are pushed
     
  14. till

    till Super Moderator Staff Member ISPConfig Developer

    Try torun just:

    UPDATE `mail_user` SET `move_junk` = 'y'

    on the master and then the resync. The resync should push the changes to the slave and execute them there when the change has been made in the /usr/local/ispconfig/server/plugins-available/maildeliver_plugin.inc.php file.
     
  15. radim_h

    radim_h Member HowtoForge Supporter

    thank you. that is what i also did and nothing happens. something is wrong :|
     
  16. till

    till Super Moderator Staff Member ISPConfig Developer

    Do you get any errors when you enable debug log level for this node in ISPConfig on the master and then run /usr/local/ispconfig/server/server.sh on the slave?
     
  17. radim_h

    radim_h Member HowtoForge Supporter

    root@admin:~# tail -f /var/log/ispconfig/ispconfig.log
    28.10.2017-09:12 - DEBUG - Calling function 'check_phpini_changes' from plugin 'webserver_plugin' raised by action 'server_plugins_loaded'.
    28.10.2017-09:12 - DEBUG - Remove Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock

    it has the same output every minut, even if i do not run server.sh on slave
     
  18. till

    till Super Moderator Staff Member ISPConfig Developer

    That's fine, so the cronjob is working. Hmm, then there might be more changes necessary to trick the mail deliver plugin to write the data.
     

Share This Page