From bb78e10e20eabd9444af3af43fb35f22adfc3aa4 Mon Sep 17 00:00:00 2001 From: strangePo <61830860+strangePo@users.noreply.github.com> Date: Fri, 29 Jan 2021 15:43:50 +0100 Subject: [PATCH 1/2] Update __init__.py Allow ham recognition if mail was automatically moved to junk folder. Currently it is not possible to trigger ham code path if the mail was moved to junk by some other program like amavis. So instead of relying on just the database a fallback to the header should be done, to recognize spam flagged by other mechanisms. --- ECtools/spamd/kopano_spamd/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ECtools/spamd/kopano_spamd/__init__.py b/ECtools/spamd/kopano_spamd/__init__.py index 7fb8f422d..b79afcf42 100644 --- a/ECtools/spamd/kopano_spamd/__init__.py +++ b/ECtools/spamd/kopano_spamd/__init__.py @@ -82,7 +82,7 @@ def update(self, item, flags): elif (item.folder == item.store.inbox and \ self.learnham and \ - self.was_spam(searchkey)): + (self.was_spam(searchkey) or header.upper() == 'YES')): fn = os.path.join(self.spamdir, searchkey + '.eml') if os.path.isfile(fn): From 807787a18f9f22f7ef504450666affba228170b4 Mon Sep 17 00:00:00 2001 From: strangePo <61830860+strangePo@users.noreply.github.com> Date: Fri, 29 Jan 2021 17:03:54 +0100 Subject: [PATCH 2/2] Update __init__.py --- ECtools/spamd/kopano_spamd/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ECtools/spamd/kopano_spamd/__init__.py b/ECtools/spamd/kopano_spamd/__init__.py index b79afcf42..308fedb64 100644 --- a/ECtools/spamd/kopano_spamd/__init__.py +++ b/ECtools/spamd/kopano_spamd/__init__.py @@ -82,7 +82,7 @@ def update(self, item, flags): elif (item.folder == item.store.inbox and \ self.learnham and \ - (self.was_spam(searchkey) or header.upper() == 'YES')): + (self.was_spam(searchkey) or (header and header.upper() == 'YES'))): fn = os.path.join(self.spamdir, searchkey + '.eml') if os.path.isfile(fn):