Custom rules does not work

Discussion in 'Installation/Configuration' started by Pyanepsion, Aug 26, 2019.

  1. Pyanepsion

    Pyanepsion Member

    Hello,
    • Debian 9
    • ISPConfig Version: 3.1.14p2 single
    • Nginx
    I receive a lot of spam every day. The message filtering function is therefore essential.
    I use the rule: if the email address is known then notify me, otherwise reject the message by giving the procedure to be in the filter.
    I just switched to the new server: a horror. No message is rejected.
    Where is the error?
    Code:
    require ["enotify","reject"];
    # rule:[cercle]
    if allof (not header :contains "from" "itsdomain.com")
    {
        reject text:
    Please contact me by phone.
    .
    ;
    }
    # rule:[notification]
    if true
    {
        notify :importance "2" :from "[email protected]" :message "notify from [email protected]" "mailto:[email protected]";
    }
    
    custom-rules.png
     
    Last edited: Aug 26, 2019
  2. Steini86

    Steini86 Active Member

    Has this worked on your old server?
    If you get so much spam, it might be worth to review your Postfix restrictions. I'm not so deep into sieve scripts, but what do the logs tell?
    You can enable debug logging in /etc/dovecot/dovecot.conf with "mail_debug = yes". Then get the logs from /var/log/mail.log
    The sieve logs should be at /var/vmail/domain.fr/mailboxname/.sieve.log
     
    Pyanepsion likes this.
  3. Pyanepsion

    Pyanepsion Member

    Hi Steini86.
    The old version of the server was using Managesieve. I tried this one and the filtering works, but it seems that we should rather use Custom Rules.
    No message is accepted except those of the senders added in the filter. If the filter does not work, it's obviously bad.
     
  4. Steini86

    Steini86 Active Member

    If you get so much spam, it might be worth to review your Postfix restrictions. I'm not so deep into sieve scripts, but what do the logs tell?
    You can enable debug logging in /etc/dovecot/dovecot.conf with "mail_debug = yes". Then get the logs from /var/log/mail.log
    The sieve logs should be at /var/vmail/domain.fr/mailboxname/.sieve.log
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Managesieve and the custom rules field are just two different technical methods to write something into the .sieve file of the server. The method you use to write the .sieve file has no influence on filtering.
     
  6. Pyanepsion

    Pyanepsion Member

    So there is a problem in Custom Rules.
    See the code above.
    I copied the contents of the rules created by ManageSieve into the Custom Rules field. With ManageSieve, the message is rejected and the sender receives a rejection message. With Custom Rules, the sender receives a rejection message, but the message remains on the email account.
     
  7. Steini86

    Steini86 Active Member

    I can't help you anymore until you provide the relevant logentries.
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    The custom rules field just writes the exact rules that you added to the .sieve files, so there is no problem in custom rules, its a problem with what you entered in there. @Steini86 told you already how to debug your rules, if you don't do that, then we can not further help you.
     
  9. Pyanepsion

    Pyanepsion Member

    Thank you, Steinni86 and Till, for your explanations. I found the errors to the sieve history.
    :p Many spam attempts mean a lot. I was obviously not going to publish here the 13,500 lines of vmail's history realized in a few moments this morning.
    Here is the reference of Sieve.
    There are 3 errors that result from a difference between ManageSieve and Custom Rules.
    1. It is better to write (Custom Rules)
    Code:
    Reject "the text of reject";
    Rather (ManageSieve)
    Code:
    reject text:
    "the text of reject"
    .
    ;
    2. The point created by ManageSieve is not understood by Custom Rules.
    3. In Custom Rules, the Stop command must be added in place of the point.
     

Share This Page