Replacement for antispam plugin

George Kontostanos
Fri, 10 Feb 2017 21:15:13 -0000

On Fri, Feb 10, 2017 at 9:59 PM, Ralph Seichter <dovecot-ml at
seichter.de>
wrote:

> On 10.02.17 20:34, Michael Slusarz wrote:
>
> > When you move a message to a new mailbox, that is a "new
message"
> > event (a new UID in the target mailbox is created; the message count
> > increases). So imap.mailbox is set to the name of the *target*
mailbox.
>
> My tests seem to indicate otherwise. Deleting a message currently
> located in the Junk folder causes the report-ham.sieve script to be
> invoked, which in my case contains the following:
>
>   require ["vnd.dovecot.pipe", "copy",
"environment"];
>   if environment "imap.mailbox" "Trash" {
>     stop;
>   } elsif environment "imap.mailbox" "Junk" {
>     pipe :copy "debug-junk";
>   } else {
>     pipe :copy "learn-ham";
>   }
>
> I can see that "learn-ham" is always invoked when a message is
deleted
> from or moved out of the Junk folder, so my guess is that imap.mailbox
> is neither "Trash" nor "Junk" ("debug-junk"
is never called, according
> to the Dovecot logs). Unfortunately I don't know how to debug this
> further.
>
> I don't want "learn-ham" to be run when a message located in
the Junk
> folder is manually deleted or moved to Trash, and right now I don't
know
> how to accomplish this.
>
> -Ralph
>

Same problem here. As a workaround I tried the following:

# From Spam folder to Inbox
  imapsieve_mailbox2_name = Inbox
  imapsieve_mailbox2_from = Spam
  imapsieve_mailbox2_causes = COPY
  imapsieve_mailbox2_before = file:/usr/lib/dovecot/sieve/report-ham.sieve

In theory this should trigger the  report-ham script, only if a mail is
moved from Spam to Inbox. However, it does not seem to work either.
--
George Kontostanos
---