Simple blacklist spam filter

277 views
Skip to first unread message

Yogu

unread,
May 18, 2012, 4:06:52 PM5/18/12
to K9 Mail Developers List
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

cketti

unread,
May 20, 2012, 10:13:22 PM5/20/12
to k-9...@googlegroups.com
I'm not sure if I want the blacklist in the settings file. But importing
and exporting is a separate issue. Let's focus on integrating the
blacklist functionality first.


> 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?

Thunderbird includes a proper spam filter. So messages that look like
spam for one account can be perfectly acceptable in another account. But
how likely is it that a user wants to block a sender in one account but
not the other? With that in mind and to keep the initial implementation
simple I say we start with a global blacklist.


> To edit the list view, can we use the exiting preference screen? I'd
> say yes, if this is possible.

I'd create a new Activity for the blacklist administration and link to
that from the global settings.

I propose the following:
1. Create a new database to store the blacklist
2. Create a ContentProvider to access the blacklist database (this will
greatly simplify the UI code)
3. Create a ListActivity to display and edit the blacklist (checkboxes
for batch deletion, edit box to add new items)
4. Modify ...activity.setup.Prefs to start the new activity
5. Modify MessagingController to use the new ContentProvider to query
the blacklist database


-cketti
Reply all
Reply to author
Forward
0 new messages