Problem on Mail filter

Discussion in 'General' started by themark, Sep 20, 2013.

  1. themark

    themark Member

    Dear,

    we have the latest ISPCONFIG (3.0.5.3) on Centos 6.2 Final SO
    We have a problem on Mail filter setup from the IPSCONFIG.

    For example:

    we want move on the folder "prova" an email that has in the subject the word "hello".

    So in the Source field we insert "Subject" and then "contains" and then "hello"

    On the Action we insert "Move to" and then "INBOX.prova" (obviously prova folder exist on the mailbox).

    Then we save.

    When i try to send an email to this mailbox, with "hello" in the subject, looking on the postfix queue, i found this error:

    """"""
    (temporary failure. Command output: /path/to/my/conf/filter/mailbox/.mailfilter(21): Syntax error after if)
    """"""

    Looking inside that file i have:

    PHP:
    SPAMDIR="Junk"
    SPAMDIRFULL="$DEFAULT/.Junk"

    if ( /^X-Spam-FlagYES$/ )
    {
      
    exception {

        `
    test -e $SPAMDIRFULL`
        if ( 
    $RETURNCODE != )
        {
          `
    maildirmake -f $SPAMDIR $DEFAULT`
          `
    chown vmail:vmail -R $SPAMDIRFULL`
          `
    chmod 0700 $SPAMDIRFULL`
          `
    echo INBOX.$SPAMDIR >> $DEFAULT/courierimapsubscribed`
        }
        
    to "$SPAMDIRFULL/"
      
    }
    }
    ### BEGIN FILTER_ID:8
    if header :regex    ["subject"] [".*hello"] {
        
    fileinto "INBOX.prova";
        
    stop;
    }
    ### END FILTER_ID:8
    What is the error, that i have spent two days in order to figure out?

    Thank you in advance, as always.
    Kind Regards.
    :)
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Do you use courier or dovecot? It seems as if your file contains some lines in courier maildrop syntax and some lines in dovecot sieve syntax.
     
  3. themark

    themark Member

    On this server we have dovecot.
    How can change mailfilter template from using maildrop instead sieve?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    The filter part created by isconfig is fine:

    ### BEGIN FILTER_ID:8
    if header :regex ["subject"] [".*hello"] {
    fileinto "INBOX.prova";
    stop;
    }
    ### END FILTER_ID:8

    Whats wrong is this part:

    SPAMDIR="Junk"
    SPAMDIRFULL="$DEFAULT/.Junk"

    if ( /^X-Spam-Flag: YES$/ )
    {
    exception {

    `test -e $SPAMDIRFULL`
    if ( $RETURNCODE != 0 )
    {
    `maildirmake -f $SPAMDIR $DEFAULT`
    `chown vmail:vmail -R $SPAMDIRFULL`
    `chmod 0700 $SPAMDIRFULL`
    `echo INBOX.$SPAMDIR >> $DEFAULT/courierimapsubscribed`
    }
    to "$SPAMDIRFULL/"
    }
    }

    ad also the name of th filter file is wrong for a sieve server, sieve filter files are named .sieve and not .mailfilter. Files with the name .mailfilter are used on courier servers.

    The syntax that ispconfig uses for the filter rules is configured under System > server config on the mail tab. Ensure that iamp server is set to dovecot there and that filter language is sieve,
     

Share This Page