Announcement

Collapse
No announcement yet.

Mail filters problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dennis Sieben
    replied
    Yes, it was what I try to do :

    dovecot.conf
    Code:
    ....
    protocol lda {
        log_path = /home/vmail/dovecot-deliver.log
        auth_socket_path = /var/run/dovecot/auth-master
        postmaster_address = postmaster@example.com
        mail_plugins = cmusieve quota
        sieve_global_dir = /home/vmail/sieve/
        global_script_path = /home/vmail/sieve/globalsieverc
    }
    .....
    And that works until the customer configures its own filter in OX.
    That's what I said. It's a fallback, so if the customer configures his filter in OX the user has it's own filter file and the global one is no more used. Because the global one is only used if there is no filter.

    I think I have installed the latest versions of Dovecot and Sieve, so i think the includes can work in my config, but my question is: in which file can i add the code?.. if i want to include the global sieve script into the "per user" OX sieve script ? (I want the spam reaches the spam folder all the time).
    The includes will surely work in your config. I meant that they will not work right with OX. Because OX doesn't now about include rules and thus will not allow to create them or edit them.

    So to use them you will have to insert the include rules manually in every users sieve script. And this include rule should link to a global rule, which is then used for everybody like you want.


    Yes, that's my "solution": I made a bash script and a crontab to add the filter "spam". Works well with the filters created in OX, but does not work with the autoresponder of OX.
    Don't know what you mean by autoresponder. Do you mean the vacation rules?

    Regards,

    Dennis

    Leave a comment:


  • dvazart
    Guest replied
    Hi.

    This works as expected from dovecots side. See http://wiki.dovecot.org/LDA/Sieve#Configuring for this "If there is no user-specific Sieve-script, global Sieve script is executed if set.". So the global script is only used as fallback.
    Yes, it was what I try to do :

    dovecot.conf
    Code:
    ....
    protocol lda {
        log_path = /home/vmail/dovecot-deliver.log
        auth_socket_path = /var/run/dovecot/auth-master
        postmaster_address = postmaster@example.com
        mail_plugins = cmusieve quota
        sieve_global_dir = /home/vmail/sieve/
        global_script_path = /home/vmail/sieve/globalsieverc
    }
    .....
    And that works until the customer configures its own filter in OX.

    A possibility to do this would be to use the include statement http://wiki.dovecot.org/LDA/Sieve#Include_scripts. But this is a new extension to sieve (http://www.mvmf.org/docs/draft-daboo...include-02.txt), which OX doesn't support. That means you will not be able to edit this include rule in the gui. But if you add it manually like below:

    if true {
    include ...
    }
    I think I have installed the latest versions of Dovecot and Sieve, so i think the includes can work in my config, but my question is: in which file can i add the code?.. if i want to include the global sieve script into the "per user" OX sieve script ? (I want the spam reaches the spam folder all the time).

    it should work. The gui should then present this rule greyed out as it's not known. But it will leave the rule as it is. But it's essential that you put the "if true" around. Just give it a try. We've never had this scenario here...

    Another solution would be to include the corresponding rules in every script when the user is created. Or if the users already exist write a bash script that add these lines to all their sieve scripts.

    HTH,

    Dennis
    Yes, that's my "solution": I made a bash script and a crontab to add the filter "spam". Works well with the filters created in OX, but does not work with the autoresponder of OX.

    Here is my script (I am not a developer, so I apologize for the code) :
    Code:
    #!/bin/bash
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    
    
    COMPTES=$(find /home/vmail/ -name .dovecot.sieve -print)
    
    for OXSIEVE in $COMPTES; do
    
    YASTA=$(grep "Ne pas effacer" $OXSIEVE)
    
    if [ -z "$YASTA" ] ; then
    
    rm "$OXSIEVE"c
    
    echo " " >> $OXSIEVE
    echo "## Flag: |UniqueId:1000|Rulename: SPAM - Ne pas effacer" >> $OXSIEVE
    echo "if header :contains \"X-Spam-Flag\" \"YES\"" >> $OXSIEVE
    echo "{" >> $OXSIEVE
    echo "    fileinto \"Spam\" ;" >> $OXSIEVE
    echo "    stop ;" >> $OXSIEVE
    echo "}" >> $OXSIEVE
    echo " " >> $OXSIEVE
    
    /usr/local/libexec/dovecot/sievec $OXSIEVE "$OXSIEVE"c
    
    echo "$OXSIEVE   HECHO !" > /var/log/sieve-spam-script.log
    
    else
    
    echo "$OXSIEVE   YA ESTA !" > /var/log/sieve-spam-script.log
    fi
    
    done
    (i accept suggestions)

    Anyway, the conflict with the autoresponder of OX i can solve it easily with Yaa! an autoresponder based on MySQL.

    Thanks !

    Leave a comment:


  • Dennis Sieben
    replied
    Hi.

    This works as expected from dovecots side. See http://wiki.dovecot.org/LDA/Sieve#Configuring for this "If there is no user-specific Sieve-script, global Sieve script is executed if set.". So the global script is only used as fallback.

    A possibility to do this would be to use the include statement http://wiki.dovecot.org/LDA/Sieve#Include_scripts. But this is a new extension to sieve (http://www.mvmf.org/docs/draft-daboo...include-02.txt), which OX doesn't support. That means you will not be able to edit this include rule in the gui. But if you add it manually like below:

    if true {
    include ...
    }

    it should work. The gui should then present this rule greyed out as it's not known. But it will leave the rule as it is. But it's essential that you put the "if true" around. Just give it a try. We've never had this scenario here...

    Another solution would be to include the corresponding rules in every script when the user is created. Or if the users already exist write a bash script that add these lines to all their sieve scripts.

    HTH,

    Dennis

    Leave a comment:


  • dvazart
    Guest started a topic Mail filters problem

    Mail filters problem

    Hi !

    I'm using :
    Everyting in MySQL (virtual users).

    So, i have a global sieve script to filter the SPAM in to the SPAM folder, and it works ok, but when customers set up a filter from Open-Xchange the global filter stops working, then the spam starts to arrive in the INBOX and the OX filter works fine !

    How can I create a filter for SPAM reaches the spam folder and OX users can configure their own filters ?

    I have another question, there is posible to set default filters for customers in OX? That would solve my problem...

    Here are my config files:

    dovecot.conf
    Code:
    protocols = imap imaps pop3 pop3s managesieve
    
    disable_plaintext_auth = no
    
    log_timestamp = "%Y-%m-%d %H:%M:%S "
    
    login_user = dovecot
    
    mail_location = maildir:/home/vmail/%d/%n/Maildir
    
    namespace private {
      separator = .
      prefix = 
      inbox = yes
    }
    
    mail_privileged_group = mail
    
    protocol managesieve {
      sieve=~/.dovecot.sieve
    }
    
    
    protocol imap {
      mail_plugins = quota imap_quota
    }
      
    
    protocol pop3 {
      mail_plugins = quota
      pop3_uidl_format = %08Xu%08Xv
    }
    
    protocol lda {
        log_path = /home/vmail/dovecot-deliver.log
        auth_socket_path = /var/run/dovecot/auth-master
        postmaster_address = postmaster@example.com
        mail_plugins = cmusieve quota
        sieve_global_dir = /home/vmail/sieve/
        global_script_path = /home/vmail/sieve/globalsieverc
    }
    
    auth_debug = yes
    
    auth_debug_passwords = yes
    
    auth default {
      mechanisms = plain login
    
      passdb sql {
        args = /usr/local/etc/dovecot-sql.conf 
      }
    
      userdb sql {
        args = /usr/local/etc/dovecot-sql.conf
      }
    
    user = vmail
    
    socket listen {
        master {
            path = /var/run/dovecot/auth-master
            mode = 0600
            user = vmail
        }
    
        client {
            path = /var/spool/postfix/private/auth
            mode = 0660
            user = postfix
            group = postfix
        }
    }
    }
    
    plugin {
    
      quota = maildir:ignore=Corbeille
    
    }
    /home/vmail/sieve/globalsieverc
    Code:
    require ["fileinto"];
    if header :contains "X-Spam-Flag" ["YES"] {
      fileinto "Pourriel";
      stop;
    }
    ls -l /home/vmail/sieve/
    Code:
    -rw-rw-r-- 1 vmail vmail   99 2009-04-28 14:58 globalsieverc
    -rw------- 1 vmail vmail  116 2009-04-28 16:36 globalsievercc
    -rw------- 1 vmail vmail  220 2009-04-28 17:58 Open-Xchange.sieve
    drwx------ 2 vmail vmail 4096 2009-04-28 17:58 tmp
    ls -al /home/vmail/example.com/user1/
    Code:
    drwx------  4 vmail vmail 4096 2009-04-29 09:34 .
    drwx------ 10 vmail vmail 4096 2009-04-28 16:36 ..
    -rw-------  1 vmail vmail  135 2009-04-28 10:21 .dovecot.lda-dupes
    lrwxrwxrwx  1 vmail vmail   32 2009-04-29 09:34 .dovecot.sieve -> Maildir/sieve/Open-Xchange.sieve
    -rw-------  1 vmail vmail  112 2009-04-29 09:34 .dovecot.sievec
    drwx------ 11 vmail vmail 4096 2009-04-29 10:09 Maildir
    drwx------  3 vmail vmail 4096 2009-04-28 17:35 sieve
    Thanks in advance !!
Working...
X