Problem with custom mail filter rule (sieve script)

Discussion in 'General' started by nightcode, Nov 17, 2022.

  1. nightcode

    nightcode New Member

    Hello,
    I've got a problem with a custom mail filter rule.
    I want to move a mail containing a calendar entry to another folder.
    I created a script for that which should work in theory:

    Code:
    require ["body", "mailbox", "fileinto"];
    
    if anyof (body :raw :contains "text/calendar", body :text :contains "text/calendar") {
      fileinto :create "INBOX.Kalender";
      #Stop nicht benötigt?
      #stop;
    }
    But I get the following error:
    The problem is that the require command has to be on top of the file but ISPConfig is using its own require directives first which I cannot change but I need the "body" requirement to apply this filter.

    Thanks for help!

    EDIT:
    I'm using ISPConfig 3.2.8p2 on Ubuntu 20.04
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    You can change that, you just have to adjust the sieve template. Run:

    Code:
    mv /usr/local/ispconfig/server/conf/sieve_filter.master /usr/local/ispconfig/server/conf-custom/sieve_filter.master
    nano /usr/local/ispconfig/server/conf-custom/sieve_filter.master
    Edit just the require line to match what you need and save the file. then alter the sieve filter rule in ISPConfig and save it to get the .sieve file of the mailbox updated.
     
  3. nightcode

    nightcode New Member

    Thanks so much till I really appreciate your fast and individual support here!
    I will try it later.

    Do I have to expect any serious performance impacts when using filters for the mail body or why isn't it loaded by default and not available in the standard filter rules?

    I'm looking forward to version 3.2.9 so I can finally upgrade my servers to jammy :)
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    ISPConfig loads the filters only that it needs for the rule editor as it makes no sense for most users to load unneeded modules. If you want to use additional modules then you must alter the template in the way I mentioned. I can't tell you anything about the performance of the body module as I personally do not use that.
     
  5. nightcode

    nightcode New Member

    Works like a charm.
    For anyone else: the changes have to be in the "before" template to affect the custom rule.
    Thanks a lot!
     
    till likes this.

Share This Page