1 (edited by SergeAv 2019-03-26 02:58:03)

Topic: Auto learn spam/ham with Dovecot and Outlook 2013-2016

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.9
- Deployed with iRedMail Easy or the downloadable installer? downloadable installer
- Linux/BSD distribution name and version: CentOS 7.6
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
Hello,
Autolearn spam doesn't work in case of using MS Outlook 2013 or 2016 as IMAP client.
As I manage to see - it happens because Outlook use APPEND event instead of COPY to move mails from folder to folder.
But a try-on to modify dovecot.conf
imapsieve_mailbox1_causes = COPY APPEND
imapsieve_mailbox2_causes = COPY APPEND
doesn't work at all.
report_spam.sieve does not start,
report_ham.sieve falls with Error: sieve: report_ham: line 15: duplicate pipe "imapsieve_copy" action not allowed (previously triggered one was here: report_spam: line 7)
I'm not sharp in coding, please help to make it work.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Auto learn spam/ham with Dovecot and Outlook 2013-2016

Finally it works for me like following:
====
    # From elsewhere to Spam folder
    imapsieve_mailbox1_name = Junk
    imapsieve_mailbox1_causes = COPY APPEND
    imapsieve_mailbox1_before = file:/var/vmail/sieve/report_spam.sieve

    # From Spam folder to elsewhere
    imapsieve_mailbox2_name = *
    imapsieve_mailbox2_from = Junk
    imapsieve_mailbox2_causes = COPY
    imapsieve_mailbox2_before = file:/var/vmail/sieve/report_ham.sieve

   # HAM Outlook
    imapsieve_mailbox3_name = Inbox
    imapsieve_mailbox3_causes = APPEND
    imapsieve_mailbox3_before = file:/var/vmail/sieve/report_ham.sieve
====

Seems that processing  APPEND event in imap_sieve plugin does not consider "From" mailbox at all. Because of it in my previous try-on to modify causes in rules moving mail from Junk folder led to the activate of both rules.

3

Re: Auto learn spam/ham with Dovecot and Outlook 2013-2016

Thanks for sharing.

SergeAv wrote:

 # HAM Outlook
    imapsieve_mailbox3_name = Inbox

I suppose we should use '*' instead of "Inbox" here? which means moving email from Junk to any other folder (except Trash).
Could you help test it?

4

Re: Auto learn spam/ham with Dovecot and Outlook 2013-2016

I listed both COPY and APPEND in imapsieve_mailbox2_causes, it works fine for me:

# Move message from elsewhere to Junk folder
    imapsieve_mailbox1_name = Junk
    imapsieve_mailbox1_causes = COPY
    imapsieve_mailbox1_before = file:/opt/iredmail/bin/dovecot/sieve/report_spam.sieve

    # Move message from Junk to other folder (except Trash)
    # Note: MUAs may move message with COPY or APPEND (MS Outlook) (IMAP) command.
    imapsieve_mailbox2_name = *
    imapsieve_mailbox2_from = Junk
    imapsieve_mailbox2_causes = COPY APPEND
    imapsieve_mailbox2_before = file:/opt/iredmail/bin/dovecot/sieve/report_ham.sieve

5 (edited by SergeAv 2019-03-27 15:19:02)

Re: Auto learn spam/ham with Dovecot and Outlook 2013-2016

The trick in your situation is that APPEND event persist in only one rule, mailbox2. If you put it to mailbox1 too (we need learning spam?), imap_sieve plugin would activate both of rules simultaneously, mailbox1 and mailbox2 in HAM procession.
Does not work  'imapsieve_mailbox2_from = Junk' for APPEND event.
So I had to add mailbox3 rule to have some method to learn HAM.

6

Re: Auto learn spam/ham with Dovecot and Outlook 2013-2016

# HAM Outlook
    imapsieve_mailbox3_name = Inbox
    imapsieve_mailbox3_causes = APPEND
    imapsieve_mailbox3_before = file:/var/vmail/sieve/report_ham.sieve

Concern: I think this behaviour is not accurate on technical side.

With this setting, APPENDing email to INBOX always triggers the report_ham action.

- If the APPEND is triggered by moving message from Junk to INBOX, it's ok. But what if user moves message from Sent/Draft/Trash to INBOX?
- [this one needs testings] What if user is importing local emails (not stored in IMAP mailbox) by drags (local) messages to INBOX folder (or something like this)?

I understand if message is moved to INBOX, it should be clean, the question is: do we really need to learn it (as ham)?

7

Re: Auto learn spam/ham with Dovecot and Outlook 2013-2016

I definitely agree, not the best solution. But I can't find work line for exception handling for APPEND. So we can to implement

imapsieve_mailbox1_causes = COPY APPEND

for SPAM learning and no ideas yet for HAM learning with MS Outlook

8

Re: Auto learn spam/ham with Dovecot and Outlook 2013-2016

I will set "imapsieve_mailbox1_causes = COPY APPEND" in Dovecot (in iRedMail Easy platform), this is perfect. Thanks again for the sharing.

But i will not add "imapsieve_mailbox3_*" for now, it's not accurate. smile

9

Re: Auto learn spam/ham with Dovecot and Outlook 2013-2016

UPDATE: document has been updated:
https://docs.iredmail.org/dovecot.imaps … eve-plugin

10

Re: Auto learn spam/ham with Dovecot and Outlook 2013-2016

Thanks a lot for your work!! iRedMail exclusively quality product.