How to log a Sieve match in Dovecot debug_log

Volker Wysk post at volker-wysk.de
Sat Jun 30 14:10:46 EEST 2018


Am Samstag, 30. Juni 2018, 12:33:49 CEST schrieb Lukas:
> This is what I wanted to avoid with my question. I reported my script with only three word just to make an example but my list is quite longer than this. Let's suppose a list of 30 or 40 words... 30 or 40 rules? Possible but very unconfortable to manage.

Okay.

> A more compact version of the script could be this:
> 
> -- the script begins ------------
>  
>    require ["fileinto", "imap4flags", "editheader", "body", "vnd.dovecot.debug"];
> 
>    if anyof (
> 
>         body :text :contains [
> 
>         "crypto", "sex", "viagra"
> 
>         ])
>    {
>      setflag "\\Seen";
>      addheader :last "X-Sieve-Filtered" "blocked words in message body";
>      fileinto "INBOX.Spam";
>      debug_log "Body contains blocked word: <the matching word>";
>    }
> 
> -- the script ends --------------
> 
> This is simpler to maintain if you have a long list of word. And here comes my previous question: it would be great if there is a way to log the matching word in order to know what word in that list was the "culprit".

I'm afraid that I can't help you, then.

Volker



More information about the dovecot mailing list