imapsieve removeflag ignored

Aki Tuomi aki.tuomi at open-xchange.com
Fri Oct 7 05:19:33 UTC 2022


> On 06/10/2022 21:12 EEST Slavko <linux at slavino.sk> wrote:
> 
>  
> Hi,
> 
> i have working SPAM reporting implementend by imapsieve in
> debian's 2.3.13 dovecot.
> 
> Recently i decide to add personal spam filter by bogofilter and
> use logic to learn/unlearn SPAM/HAM based on message flags.
> Here is example of moving message from Junk folder (the
> opossite logic is similar):
> 
>     if hasflag "$Junk" {
>         execute :pipe "bogofilter" ["-Sn"];
>         removeflag "$Junk";
>         debug_log "Learned HAM (and unlearned)"; }
>     else {
>         execute :pipe "bogofilter" ["-n"];
>         debug_log "Learned HAM (only)";
>     }
>     # mark as learned
>     addflag "$NotJunk";
> 
>    report ...
> 
> When i move message, the debug lines in log shows, that
> logic works and flag is added as expected, but the other
> flag is not removed. Thus after moving mail from Junk, which
> has $Junk flag, it has both flags, the $Junk and $NotJunk.
> 
> I tried to move removeflag action outside of condition and
> add it just before addflag, but the result is the same.
> 
> For now i do not know if here is something wrong in my script,
> or i did some other mistake. On IRC cmouse tell, that removeflag
> was fixed in some early version (2.3.5 or so), but it doesn't work
> here.
> 
> Please, how i can get it working?
> 
> regards
> 
> PS: please CC me, i am not subscribed
> 
> -- 
> Slavko
> https://www.slavino.sk/

Hi!

We gave this a try and it seems to work just fine. Can you provide us with mail_debug=yes logs, and also

plugin {
  sieve_trace_debug = yes
  sieve_trace_dir = ~/sieve_debug/
  sieve_trace_level = matching
}

then make sieve_debug directory for your user's homedir, and make sure it's writable by that user. There should be a trace file there outlining what happened with your script.

Aki


More information about the dovecot mailing list