On Fri, Feb 10, 2017 at 03:52:52PM +0100, Ralph Seichter wrote:>On 10.02.2017 09:06, Aki Tuomi wrote: > >> Since antispam plugin is deprecated and we would really prefer people >> not to use it, we wrote instructions on how to replace it with IMAPSieve. > >In my setup, I use the following sieve script globally for all users: > > if header :is "X-Spam-Flag" "YES" { > fileinto "Junk"; > stop; > } > >This allows processing based on spam flags set by Amavis/SpamAssassin. >I wonder if the method shown in > > https://wiki.dovecot.org/HowTo/AntispamWithSieve > >will cause incoming mail (via LMTP) that is already flagged as spam to >be processed by report-spam.sieve and, in consequence, will be learned >as spam for a second time, which would of course be undesirable?It shouldn't do. Check out https://wiki.dovecot.org/Pigeonhole/Sieve/Plugins/IMAPSieve, which explains that sieve is normally only used at delivery time, but the sieve_imapsieve plugin runs a *different* sieve script based on IMAP actions (for example, COPY). So, when you deliver, your main script tells dovecot WHERE to deliver to. When you issue and IMAP COPY command, the Antispam scripts tell dovecot to pipe the message to spamassassin. The delivery does not involve IMAP and the IMAP COPY does not constitute redelivery. -- For more information, please reread.
On Fri, Feb 10, 2017 at 5:09 PM, Darac Marjal <mailinglist at darac.org.uk> wrote:> On Fri, Feb 10, 2017 at 03:52:52PM +0100, Ralph Seichter wrote: > >> On 10.02.2017 09:06, Aki Tuomi wrote: >> >> Since antispam plugin is deprecated and we would really prefer people >>> not to use it, we wrote instructions on how to replace it with IMAPSieve. >>> >> >> In my setup, I use the following sieve script globally for all users: >> >> if header :is "X-Spam-Flag" "YES" { >> fileinto "Junk"; >> stop; >> } >> >> This allows processing based on spam flags set by Amavis/SpamAssassin. >> I wonder if the method shown in >> >> https://wiki.dovecot.org/HowTo/AntispamWithSieve >> >> will cause incoming mail (via LMTP) that is already flagged as spam to >> be processed by report-spam.sieve and, in consequence, will be learned >> as spam for a second time, which would of course be undesirable? >> > > It shouldn't do. Check out https://wiki.dovecot.org/Pigeo > nhole/Sieve/Plugins/IMAPSieve, which explains that sieve is normally only > used at delivery time, but the sieve_imapsieve plugin runs a *different* > sieve script based on IMAP actions (for example, COPY). > > So, when you deliver, your main script tells dovecot WHERE to deliver to. > When you issue and IMAP COPY command, the Antispam scripts tell dovecot to > pipe the message to spamassassin. The delivery does not involve IMAP and > the IMAP COPY does not constitute redelivery. > > > -- > For more information, please reread. >I think that this needs some change: # From Spam folder to elsewhere imapsieve_mailbox2_name = * imapsieve_mailbox2_from = Spam imapsieve_mailbox2_causes = COPY imapsieve_mailbox2_before = file:/usr/lib/dovecot/sieve/report-ham.sieve When a message from Spam is moved to Trash then the report-ham.sieve is being executed. Can we add an exception for the Trash folder? Thanks -- George Kontostanos ---
On Fri, Feb 10, 2017 at 6:25 PM, George Kontostanos <gkontos.mail at gmail.com> wrote:> > > On Fri, Feb 10, 2017 at 5:09 PM, Darac Marjal <mailinglist at darac.org.uk> > wrote: > >> On Fri, Feb 10, 2017 at 03:52:52PM +0100, Ralph Seichter wrote: >> >>> On 10.02.2017 09:06, Aki Tuomi wrote: >>> >>> Since antispam plugin is deprecated and we would really prefer people >>>> not to use it, we wrote instructions on how to replace it with >>>> IMAPSieve. >>>> >>> >>> In my setup, I use the following sieve script globally for all users: >>> >>> if header :is "X-Spam-Flag" "YES" { >>> fileinto "Junk"; >>> stop; >>> } >>> >>> This allows processing based on spam flags set by Amavis/SpamAssassin. >>> I wonder if the method shown in >>> >>> https://wiki.dovecot.org/HowTo/AntispamWithSieve >>> >>> will cause incoming mail (via LMTP) that is already flagged as spam to >>> be processed by report-spam.sieve and, in consequence, will be learned >>> as spam for a second time, which would of course be undesirable? >>> >> >> It shouldn't do. Check out https://wiki.dovecot.org/Pigeo >> nhole/Sieve/Plugins/IMAPSieve, which explains that sieve is normally >> only used at delivery time, but the sieve_imapsieve plugin runs a >> *different* sieve script based on IMAP actions (for example, COPY). >> >> So, when you deliver, your main script tells dovecot WHERE to deliver to. >> When you issue and IMAP COPY command, the Antispam scripts tell dovecot to >> pipe the message to spamassassin. The delivery does not involve IMAP and >> the IMAP COPY does not constitute redelivery. >> >> >> -- >> For more information, please reread. >> > > I think that this needs some change: > > # From Spam folder to elsewhere > imapsieve_mailbox2_name = * > imapsieve_mailbox2_from = Spam > imapsieve_mailbox2_causes = COPY > imapsieve_mailbox2_before = file:/usr/lib/dovecot/sieve/report-ham.sieve > > When a message from Spam is moved to Trash then the report-ham.sieve is > being executed. > > Can we add an exception for the Trash folder? > > Thanks > > > -- > George Kontostanos > --- >Could we use something like this: imapsieve_mailbox2_name = ! Trash -- George Kontostanos ---
On 10.02.2017 16:09, Darac Marjal wrote:> Check out https://wiki.dovecot.org/Pigeonhole/Sieve/Plugins/IMAPSieve, > which explains that sieve is normally only used at delivery time, but > the sieve_imapsieve plugin runs a *different* sieve script based on > IMAP actions (for example, COPY).Thanks for the pointer, Darac. The following confirms that imapsieve_* is not involved during delivery: "Note that the imapsieve extension can only be used in a Sieve script that is invoked from IMAP. When it is used in the active delivery script, it will cause runtime errors." -Ralph
> On Feb 11, 2017, at 12:50 AM, Ralph Seichter <dovecot-ml at seichter.de> wrote: > > Check out https://wiki.dovecot.org/Pigeonhole/Sieve/Plugins/IMAPSieve,My concern is, will you experience any lag while moving message? According to the doc, this plugin works like ?pipe? backend of old ?antispam? plugin, when you move a message from INBOX to Junk, the antispam plugin calls sa-learn, and you will experience noticeable lag on webmail (i used Roundcube webmail for testing) until sa-learn finished. It's much worse if you move multiple emails at the same time, because we have to wait for sa-learn to learn all moved messages. I switched to ?spool2dir? backend of old ?antispam? plugin, and call sa-learn hourly to learn spam/ham. Since it simply copies moved message(s), no lag on webmail side at all, our users are satisfied. ---- Zhang Huangbin, founder of iRedMail project: http://www.iredmail.org/ Time zone: GMT+8 (China/Beijing).
> On February 10, 2017 at 9:25 AM George Kontostanos <gkontos.mail at gmail.com> wrote:[snip]> I think that this needs some change: > > # From Spam folder to elsewhere > imapsieve_mailbox2_name = * > imapsieve_mailbox2_from = Spam > imapsieve_mailbox2_causes = COPY > imapsieve_mailbox2_before = file:/usr/lib/dovecot/sieve/report-ham.sieve > > When a message from Spam is moved to Trash then the report-ham.sieve is > being executed. > > Can we add an exception for the Trash folder?This is handled in the sieve script. E.g.: require "environment"; if environment "imap.mailbox" "Trash" { stop; } michael