nextcloud / mail

💌 Mail app for Nextcloud
https://apps.nextcloud.com/apps/mail
GNU Affero General Public License v3.0
840 stars 260 forks source link

Client-side spam filtering #9217

Open viktorix opened 9 months ago

viktorix commented 9 months ago

Is your feature request related to a problem? Please describe.

Email spam is the main problem. Mail app allows users to "Mark as spam" but it simply moves the email to the Spam folder, it doesn't actually do anything useful to help reduce/fight spam.

Describe the solution you'd like

Ideally, it would be helpful if the Mail app included a built-in spam filter that could be trained by marking emails as spam. Similar to how Thunderbird allows users to train spam filter.

Another option, offer integration with a third-party spam solution. Ideally, open source, like SpamAssassin. Something similar to how Sieve is used for filtering emails or Talk uses TURN server.

Mail app should also respect spam headers set by server-side spam filters, such as SpamAssassin. This could be an option for users to select, here's how Thunderbird handles it: image

Describe alternatives you've considered

Nothing can be done with the "Mark as spam" option right now.

Additional context

Thunderbird's adaptive filtering:

Thunderbird's primary method of dealing with junk mail is an adaptive filter. Thunderbird's adaptive filter actually learns how it should classify e-mail by learning from your habits.

If you consistently mark a certain type of e-mail as junk, Thunderbird will learn that that type of e-mail should be marked as spam in the future. However, e-mail that you wish to receive will not be marked as spam, because Thunderbird's filter is entirely based on your actions.

The filter improves as it watches how you sort your e-mail, and with time the filter will reach nearly 100% classification accuracy. More important, however, is that the filter is intentionally conservative in what it marks as junk mail. If Thunderbird can't quite decide whether an e-mail is junk or not, it will mark it as not spam. It's that simple -- after training, the filter simply doesn't create false positives.

ChristophWurst commented 17 hours ago

This is technically doable, but has downsides. A server-side filter works synchronously - it filters the messages before they are appended to a user's inbox. A client-side filter in this app is lagging behind. If you connect Mail and K9/Android to the same IMAP server you might see a spam message pop up on your phone but "disappear" 20 minutes later when Mail is synchronizing and running the local spam filter. It's the same problem with clients doing local filtering or local autoresponders.

Mail app should also respect spam headers set by server-side spam filters, such as SpamAssassin. This could be an option for users to select, here's how Thunderbird handles it:

That's something we can definitely do.