If the IMAP server does not provide a spam filter, there is currently
no way to avoid continuous notifications when spam arrives. To solve
this problem, I implemented a simple blacklist-based spam filter
extension to K-9.
Shortly after I posted this extension on my website, I received eleven
visits coming from a google search for "k-9 spam filter", so I think
this feature is requested by users.
On github, I posted a pull request with a first approach:
https://github.com/k9mail/k-9/pull/148
The filter is disabled by default and can be enabled in the account
options. If enabled, mails moved to the spam folder are declared as
spam and their sender addresses are added to the blacklist. On the
other hand, mails moved out from the spam folder to another location
are assumed not to be spam; their sender address is removed from the
blacklist. The blacklist can be easily edited in the account
preferences.
cketti's response:
> I like the idea of a simple blacklist. But using the preference storage to save the blacklisted addresses is a very bad idea and doesn't scale very well. They should be stored in a separate database table.
Also, the user interface to view/modify the list of blacklisted email
addresses should probably use a ListView, not a simple EditText
widget.
> If you are willing to make the necessary changes I am more than happy to tell you what exactly I have in mind and answer any questions you might have. We can discuss this on the developer mailing list (
https://groups.google.com/group/k-9-dev), on IRC (#k-9, Freenode) where many of the K-9 developers can be found, or you can reach me via email (cketti [at] Gmail, German is fine).
Thank you for your response, cketti. Your suggestions sound good, I'll
see what I can do. But I have a few questions:
We should export the blacklist when the preferences are exported, so
that users can keep it when they move to another phone etc. What would
be the best way to archive this? Is there currently any non-preference
data exported, or should we add a patch to
com.fsck.k9.preferences.SettingsExporter?
Does the blacklist belong to one specific account or to all accounts?
Thunderbird assings junk data to one account, and this is fine when
e.g. the buisness mail account should use a different blacklist than
the private account. On the other hand, it may sometimes good to have
a global blacklist. Should we provide an option to the user?
To edit the list view, can we use the exiting preference screen? I'd
say yes, if this is possible.
Yogu