Bug 255388

Summary: Kmail filters dont work in incoming mail
Product: [Frameworks and Libraries] Akonadi Reporter: Zé <mmodem00>
Component: Mail Filter AgentAssignee: kdepim bugs <kdepim-bugs>
Status: REOPENED ---    
Severity: normal CC: ab4bd, abin.gecb, aheinecke, alex, alexanders83, amantia, aspotashev, b7792105, bugs, cfigura77, christiandehne, Craig.Magina, detlev.casanova, dev-kde, dmitry, ebischoff, eric.vanh, faxel, fest.in, fire, forums.encelade, franksouza183, gaantonio, hatto, host71, infrabit, ivan.cukic, jlayt, john.pagourtzis, juergen, juha.heljoranta, kde.org, kirill.bogdanenko, korossy, m.wege, mail, marcinkocur, matija, metkometko, mmtsales, pjetur, quazgar, r.biegel, rapiteanu.catalin, rasasi78, rutgert, superaphke, sven.burmeister, sven, t.m.guymer, thomas, tlnd, tokoe, tom-kde.bugs, volkerarmin
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 4.10.1
Attachments: boudewijn's kmail config files (~/.kde/share/config/kmail*)
Kmail2rc
kmail*rc files
KMail2 configuration files (AvL)
kmail2rc
Filter section in kmail2rc
Akonadi Log
Akonadi Log Information view
Filters configuration file.
Filter log showing filtering applied twice to same message

Description 2010-10-27 12:40:37 UTC
Version:           2.0 beta1 (using Devel) 
OS:                Linux

I have a filter thats to move to a certain folder all mails that belong to a certain mailing list.

Since i use kmail-2.0 beta 1, the incoming mail isnt filtered anymore, the filter isnt doing anymore what was suposed to do.
However if i select the mails of that mailing list that are in the inbox folder, then right click and select the filter, those messages are moved to the folder that is set in the filter definitions.

So why isnt the filter working to the incoming mail??

Reproducible: Always




OS: Linux (x86_64) release 2.6.33.7-desktop-2mnb
Compiler: gcc
Comment 1 Halla Rempt 2010-11-26 11:46:30 UTC
Same here, I upgraded to KDE 4.6 b1 this morning and got a beta of kmail 2, and the mail in my inbox was never moved out of it to the other folders by my filters.
Comment 2 Valentin Rusu 2010-12-01 23:20:11 UTC
Same on my openSuSE box, after I upgraded to KMail 2.0.89 on KDE 4.5.80 (4.6 beta 1). I also confirm that manually applying filters on the message from it's contextual menu works.
Comment 3 Fest 2010-12-02 17:38:14 UTC
Confirm same bug on Gentoo amd64 and KDE 4.6 beta 1.
Comment 4 Tobias Koenig 2010-12-12 13:54:02 UTC
Hej guys,

can you please post the exact configuration of your filters, e.g. what you have configured as inbox folder to filter on, on which resource the inbox folder is located etc.

It works fine for me if the filter points to my standard LocalFolders/inbox and pop3 resource feeds new mails into this folder, but it seems some slightly different configurations don't work. So I need the exact information to reproduce/fix it.
Thanks in advance!

Ciao,
Tobias
Comment 5 Halla Rempt 2010-12-12 14:49:04 UTC
No problem, I'll attach my config file now.
Comment 6 Halla Rempt 2010-12-12 14:50:39 UTC
Created attachment 54457 [details]
boudewijn's kmail config files (~/.kde/share/config/kmail*)
Comment 7 Fest 2010-12-12 16:56:16 UTC
Created attachment 54465 [details]
Kmail2rc
Comment 8 Christian Trippe 2010-12-12 19:35:09 UTC
Created attachment 54470 [details]
kmail*rc files

As written in bug 256389, which is maybe a duplicate of this one, I found the following facts which make filtering of incoming massages not work:
a) If the filter is set to apply only for a selected (pop3) account filtering does work on kmail start up or when applied manually via Ctrl+J. It does _not_ work when fetching new mail with a running kmail. It works if the filter is set to apply for all accounts.
b) Have your account configured to have the 'target folder' different from the standard inbox
=> filter do not work for incoming mail (neither on kmail start up nor when fetching new mail with running kmail), only when applied manually (Ctrl+J)
Comment 9 m.wege 2010-12-15 10:31:52 UTC
*** Bug 259687 has been marked as a duplicate of this bug. ***
Comment 10 m.wege 2010-12-15 18:40:36 UTC
I have used the filter log viewer which is part of Kmail2. The filter viewer does not log anything on incoming mails, but it writes logs wenn I manualy kick in the filter.
Comment 11 Fest 2010-12-29 15:17:40 UTC
Since update to Kontact 4.6 beta3, filter mail is working in my case.
Comment 12 m.wege 2010-12-29 18:50:05 UTC
I wish I could say the same. I have also upgraded, but filtering is not working.
Comment 13 Alexander van Loon 2010-12-29 22:42:41 UTC
Created attachment 55361 [details]
KMail2 configuration files (AvL)

Today I installed a fresh Kubuntu 10.10 and upgraded immediately to Kontact 4.6 beta 3. After that upgrade I used Kontact for the first time and specified my filters. My filters operate on the Inbox of an IMAP account. I have three filters which filter on the List-Id header and the X-Bugzilla-URL header and move the relevant messages to different subdirectories of the Inbox of that IMAP-account. In the 'Advanced' section of the 'Configure Filters...' dialog I've set the options for all three filters to apply them to incoming messages and to only apply filters to the specific IMAP-account which is receiving those messages (I have another IMAP-account as well which doesn't need filtering). Like the other commenter, manually applying the filter works fine, but KMail doesn't do it automatically on incoming messages. So beta 3 doesn't fix it for me either.
Comment 14 Björn Balazs 2011-01-31 13:08:52 UTC
Problem still there in OpenSuse 11.3 and Kubuntu 10.10 both with Kontact 4.6 / Kmail 2.0.89:

Filter are not applied on incoming mails, but work fine when applied manually.
Comment 15 Charlie Figura 2011-02-04 15:00:35 UTC
I'm experiencing this same problem, but I can't figure out a pattern.  I have a number of filters (about 12).  All of them seem to work properly EXCEPT my spam/ham moving filters.  The first few filters work correctly (including classifying the mail as ham/span), but the next three (move to one place if it's spam, to another if it's ham, to a third if it's unsure) do NOT run automatically, but DO work if applied manually (as indicated above).  The filters AFTER these three DO work properly automatically.

I've been unable to find *any* difference between those three (which don't run automatically) and the others.
Comment 16 John Layt 2011-02-27 11:46:55 UTC
My filters also don't work after migration, and also if starting fresh and importing a previously exported from KMail1 filters list.  Creating a new filter in KMail2 processes OK. In KMail2 the filter actions show as "Unknown Folder" and the relevant line from from the export file is:

    action-args-0=.Computers.directory/.KDE.directory/kde-pim-meeting

This compares to an export of a new filter from KMail2 which shows:

    action-args-0=105

Looks like KMail2 uses a very different means of referring to folders.

Note that my mail folders are in ~/.Mail, but that shouldn't affect things.
Comment 17 John Layt 2011-02-27 11:56:54 UTC
Oh, and contents of the kmail2rc filter after the migration showing migrated account but unmigrated folder:

[Filter #0]
Applicability=0
AutomaticName=false
ConfigureShortcut=false
ConfigureToolbar=false
Icon=
StopProcessingHere=true
ToolbarName=<List-Id>:<kde-pim-meeting.kde.org>
accounts-set=akonadi_mixedmaildir_resource_0
action-args-0=.Computers.directory/.KDE.directory/kde-pim-meeting
action-name-0=transfer
actions=1
apply-on=check-mail,manual-filtering
contentsA=<kde-pim-meeting.kde.org>
fieldA=List-Id
funcA=contains
name=<List-Id>:<kde-pim-meeting.kde.org>
operator=and
rules=1
Comment 18 Charlie Figura 2011-02-27 16:29:27 UTC
I've tried wiping out ALL of my filters and restarting.  Now I'm having the larger problem that my bogofilter filtering won't work.  It's set up to pipe the email through bogofilter and play a chime (so I could tell if it was running).
When the filter runs, the chime sounds, but the message is NOT being piped through the filter.

[Filter #0]
Applicability=2
AutomaticName=false
ConfigureShortcut=true
ConfigureToolbar=false
Icon=
StopProcessingHere=false
ToolbarName=Bogofilter
accounts-set=akonadi_imap_resource_0,akonadi_pop3_resource_0
action-args-0=/usr/bin/bogofilter -pev -c /home/cfigura/.bogofilter/.bogofilter.cf
action-args-1=/usr/share/sounds/Kopete_Received.ogg
action-name-0=filter app
action-name-1=play sound
actions=2
apply-on=check-mail,manual-filtering
contentsA=0
fieldA=<size>
funcA=greater
name=Bogofilter
operator=or
rules=1

[General]
filters=1
Comment 19 S. Burmeister 2011-03-23 12:48:03 UTC
Info was supplied so the status should be changed to new or assigned.
Comment 20 Christian Trippe 2011-03-23 19:12:21 UTC
One additional point: Filters only work when your default inbox is called "inbox". If you create a new user with e.g. German localization where it is called "Posteingang" filters do not work on incoming mail.
Comment 21 Matija Šuklje 2011-04-27 14:53:33 UTC
I can confirm this on Gentoo amd64, KDE 4.6.2, KDEPIM 4.6. (incl. KMail) pulled from Git on 2011-04-11, Akonadi 1.5.2.

At least in my case I've noticed this:
* *no* filters apply automatically to e-mail that is pulled by IMAP
* filters *do* automatically apply for e-mail that is pulled by POP
* all filters work just fine if triggered by hand

From this I suspect that the problem is not in particular filters, but just that incoming IMAP messages do not trigger the switch that applies the filters to them.

Before anyone asks the obvious: filters have been migrated from KMail1 and are set (applied by hand again) to automatically apply to incoming from all resources.
Comment 22 Frank Steinmetzger 2011-04-27 17:01:43 UTC
I am in the exact same situation as Matija, only on Gentoo x86, 4.6.2, kdepim 4.5.95. Automatic filters work for POP. For IMAP they only work when triggered manually.

I have described the Spamfilter problem in detail in a bug of my own (#266154).
Comment 23 Matija Šuklje 2011-04-27 17:08:24 UTC
(In reply to comment #22)
> I am in the exact same situation as Matija, only on Gentoo x86, 4.6.2, kdepim
> 4.5.95. Automatic filters work for POP. For IMAP they only work when triggered
> manually.
> 
> I have described the Spamfilter problem in detail in a bug of my own (266154).

If your spam filter is applied as well, when you manually trigger the filters, bug #266154 may well be a duplicate of this one.

Is this still not enough info?
If so, I'd be happy to provide it (e.g. my kmail2rc) if someone told me what parts, if any, I should blank out for security and privacy reasons.
Comment 24 Frank Steinmetzger 2011-04-28 05:19:34 UTC
When I click “Mark as Spam”, the filter action is carried out (move to Spam folder).

But even if the source of our two problems is the same (different handling of folders), I think my spam isssue and this one still constitute two different problems. This bug is about filters not getting triggered for IMAP mails, and mine is about mails not getting the Spam header from Bogofilter.
The Spamfilter is triggered alright here. I tested it by changing the pipe through command from “bogofilter -p -e” to “tee /some/file | bogofilter -p -e” and sent me a mail. Once I received it, /some/file was there with the content of the mail.
Comment 25 Michael F. 2011-05-13 14:24:57 UTC
*** This bug has been confirmed by popular vote. ***
Comment 26 Rutger 2011-05-16 15:04:27 UTC
I too am experiencing the same symptoms under KDE 4.6.3. Under the Kmail Filter Rules, I have certain filters set to "Apply this filter to incoming messages >> from all but online IMAP accounts".  However, the flag that tells Kmail not to apply the filter to IMAP Emails is ignored and all Email from all accounts is filtered using the filter no matter the source (POP or IMAP accounts).
Comment 27 Jakub Caban 2011-05-21 11:48:32 UTC
And exactly same here.

Newest KDEPIM (4.5.96 I believe), KDE 4.6.3 on Gentoo.

I use only IMAP and have quite a few filters triggered for specific accounts.

None of them gets applied - I have to constantly ctrl+J them.
Comment 28 S. Burmeister 2011-05-21 14:03:52 UTC
Filtering works for me, i.e. moving to local folders.

Bogofilter does not work because the headers are not modified but that's bug 266154.
Comment 29 S. Burmeister 2011-05-21 14:09:43 UTC
Forgot to add: My kmail version is KMail 2.0.89 and the incoming mails are in Posteingang (German for inbox) and not some other folder.

It only works once though, i.e. if they are retrieved. If they have been retrieved they are not treated as incoming and thus filters not applied.
Comment 30 Fest 2011-05-21 16:54:07 UTC
Gentoo, amd64, KDE 4.6.3, KDE PIM 2.0.96

Filters works ok, with one exception.
Rule "From is in address book" not working, instead applying to such messages different rules.
Comment 31 Andre Heinecke 2011-05-25 20:11:11 UTC
Git commit 77349b1a20cb4e3d2689bcb3148a3c3e36e43492 by Andre Heinecke.
Committed on 25/05/2011 at 19:53.
Pushed by aheinecke into branch '4.6'.

Fix message filtering on startup.

    When the FilterManager was constructed it tried to filter the
    unread messages in the inbox before it had loaded the filtersettings.
    This caused it only to filter new messages while it was running.

    With this patch the tryToFilterInboxOnStartup function will always
    be called when new filters are added. (e.g. After the config is read)
    The delay in which the filter checks if the inbox is valid has also
    been reduced to avoid situations where the user can look at a mail
    in the inbox which is about to be filtered.

    This patch was provided by steveire

    BUG: 255388
    CCBUG: 257984

M  +2    -2    mailcommon/filtermanager.cpp     

http://commits.kde.org/kdepim/77349b1a20cb4e3d2689bcb3148a3c3e36e43492
Comment 32 Matija Šuklje 2011-05-26 11:45:48 UTC
Updated KDEPIM yesterday (25 May 2011 22:14:38 GMT+1) from Git and I still have to manually run filters on incoming IMAP messages.

I double-checked that the revision that was pulled and compiled was newer then the one with the bug solution.
Comment 33 Matija Šuklje 2011-05-29 00:13:28 UTC
The filters stil do not apply automatically in today's revision 3ad3f45d94297c19e6093a4704f8b91ee72f17ce

Applying them by hand (still) works just as well.

I propose reopening it.
Comment 34 Matija Šuklje 2011-05-29 00:24:59 UTC
Created attachment 60418 [details]
kmail2rc

I'm attaching my (somewhat anonymised) kmail2rc config file, if it happens to be something wrong with my settings.
Comment 35 Andre Heinecke 2011-05-31 21:02:58 UTC
Git commit 1dbe3bf4fee4ed41338f196765f4cdd5d2424d30 by Andre Heinecke.
Committed on 31/05/2011 at 20:38.
Pushed by aheinecke into branch '4.6'.

Fix inbox filtering for mailservers that use .inbox

    The remoteID .inbox was not recognized by the kmail kernel
    before. With this commit inbox mail filters will also be
    applied for inboxes with the remoteID .inbox

    CCBUG: 255388

M  +3    -1    mailcommon/mailkernel.cpp     

http://commits.kde.org/kdepim/1dbe3bf4fee4ed41338f196765f4cdd5d2424d30
Comment 36 Matija Šuklje 2011-06-02 01:42:54 UTC
Andre's patch solved it for me as well.

Thanks :)
Comment 37 Éric Bischoff 2011-09-09 12:11:57 UTC
Hello everyone,

Sorry for the bad news, but this bug has hit me with kmail 4.7.1, after the update from kmail 4.7.0, as part of the kubuntu oneiric beta versions.

Same symptom as everyone, i.e. manually applying the filter works, but it does not apply automatically.

One of the differences between 4.7.0 and 4.7.1 is that "inbox" is now called "boîte de réception", which is French for "inbox". Perhaps it's related?

In akonadi, the "Dossiers locaux" data source uses ~/.local/share/local-mail/.

I suggest reopening the bug report, as this looks like a regression.
Comment 38 Éric Bischoff 2011-09-15 15:59:49 UTC
Created attachment 63669 [details]
Filter section in kmail2rc
Comment 39 Christophe Marin 2011-09-15 16:04:18 UTC
reopening then
Comment 40 Éric Bischoff 2011-09-15 16:50:13 UTC
Merci Christophe / thank you
Comment 41 Dirk Seidel 2011-12-02 01:01:33 UTC
I had the same problem and after starting a clean kde session (removing ~/.kde) the problem has disappeared.
Comment 42 mkkot 2011-12-09 23:35:34 UTC
The same problem here after updating to 4.7.4 (and all previous 4.7 I guess): in configuration bogofilter applies to everything apart of IMAP, mailbox folder is called differently and tied in account's configuration - manual filtering works but spam messages aren't automatically moved to trash.

I made filter (yes)|(spam\b) available in RMB menu and executing it manually for a message works.
Comment 43 Alexander Stein 2011-12-12 13:26:55 UTC
I upgraded to 4.7.3 (Gnetoo stable) from 4.4.11 and also noticed the Mail filter problem. Filter on POP3 accounts works, but on IMAP it doesn't. Appllying filters manually works, but only on already fetched mails. So Ctrl+A and Ctrl+J does only work on mais previosly fetched (same for click and shift+click to get a list).
But i noticed something interesting: Filter _do_ work on IMAP accounts, if I filter on To, rather than List-ID for mailing lists. This obviously only works for initial mails and not replies.
So I launched the Filter Log Viewer and noticed the following filter output on a mail i wrote to myself in To and CC:
------------------------------
[14:24:26] Evaluating filter rules: (match any of the following) "To" <contains> "<linux-arm-kernel.lists.infradead.org>" "CC" <contains> "<linux-arm-kernel.lists.infradead.org>"
[14:24:26] 0 = "To" <contains> "<linux-arm-kernel.lists.infradead.org>" (alexander.stein@informatik.tu-chemnitz.de)
[14:24:26] 0 = "CC" <contains> "<linux-arm-kernel.lists.infradead.org>" ()
[14:24:26] Evaluating filter rules: (match all of the following) "List-Id" <contains> "<linux-arm-kernel.lists.infradead.org>"
[14:24:26] 0 = "List-Id" <contains> "<linux-arm-kernel.lists.infradead.org>" ()
[14:24:26] Evaluating filter rules: (match all of the following) "CC" <contains> "linux-kernel@vger.kernel.org"
[14:24:26] 0 = "CC" <contains> "linux-kernel@vger.kernel.org" ()
[14:24:26] Evaluating filter rules: (match any of the following) "To" <contains> "linux-kernel@vger.kernel.org" "CC" <contains> "linux-kernel@vger.kernel.org"
[14:24:26] 0 = "To" <contains> "linux-kernel@vger.kernel.org" (alexander.stein@informatik.tu-chemnitz.de)
[14:24:26] 0 = "CC" <contains> "linux-kernel@vger.kernel.org" ()
[14:24:26] Evaluating filter rules: (match all of the following) "List-Id" <contains> "<u-boot.lists.denx.de>"
[14:24:26] 0 = "List-Id" <contains> "<u-boot.lists.denx.de>" ()
---
If I manually apply the filter, I get the following output:
------------------------------
[14:25:42] Evaluating filter rules: (match all of the following) "List-Id" <contains> "<wireshark-dev.wireshark.org>"
[14:25:42] 0 = "List-Id" <contains> "<wireshark-dev.wireshark.org>" ()
[14:25:42] Evaluating filter rules: (match any of the following) "To" <contains> "<linux-arm-kernel.lists.infradead.org>" "CC" <contains> "<linux-arm-kernel.lists.infradead.org>"
[14:25:42] 0 = "To" <contains> "<linux-arm-kernel.lists.infradead.org>" (alexander.stein@informatik.tu-chemnitz.de)
[14:25:42] 0 = "CC" <contains> "<linux-arm-kernel.lists.infradead.org>" (alexander.stein@informatik.tu-chemnitz.de)
[14:25:42] Evaluating filter rules: (match all of the following) "List-Id" <contains> "<linux-arm-kernel.lists.infradead.org>"
[14:25:42] 0 = "List-Id" <contains> "<linux-arm-kernel.lists.infradead.org>" ()
[14:25:42] Evaluating filter rules: (match all of the following) "List-Id" <contains> "<linux-can.vger.kernel.org>"
[14:25:42] 0 = "List-Id" <contains> "<linux-can.vger.kernel.org>" ()
[14:25:42] Evaluating filter rules: (match all of the following) "CC" <contains> "linux-kernel@vger.kernel.org"
[14:25:42] 0 = "CC" <contains> "linux-kernel@vger.kernel.org" (alexander.stein@informatik.tu-chemnitz.de)
[14:25:42] Evaluating filter rules: (match any of the following) "To" <contains> "linux-kernel@vger.kernel.org" "CC" <contains> "linux-kernel@vger.kernel.org"
[14:25:42] 0 = "To" <contains> "linux-kernel@vger.kernel.org" (alexander.stein@informatik.tu-chemnitz.de)
[14:25:42] 0 = "CC" <contains> "linux-kernel@vger.kernel.org" (alexander.stein@informatik.tu-chemnitz.de)
[14:25:42] Evaluating filter rules: (match all of the following) "List-Id" <contains> "<u-boot.lists.denx.de>"
[14:25:42] 0 = "List-Id" <contains> "<u-boot.lists.denx.de>" ()
---
It seems not all E-Mail headers are passed to the filter upon initial mail reception.
Comment 44 infrabit 2012-01-01 17:57:57 UTC
Having a setup with several filters that apply to my IMAP account followed by 
several other filters that only apply to one of the five POP3 accounts, IMAP 
filters work fine and the POP3 filters did not work (i.e. email landed into 
Inbox) until I selected "from all accounts".

Running:

   $ kmail --version
   Qt: 4.7.4
   KDE Development Platform: 4.7.3 (4.7.3)
   KMail: 4.7.3


Much thanks.
Comment 45 mkkot 2012-02-04 00:38:08 UTC
It stopped to work for me in 4.8.0...
Comment 46 S. Burmeister 2012-02-04 19:54:02 UTC
(In reply to comment #45)
> It stopped to work for me in 4.8.0...

It was fixed in 4.8.0 for some filter criteria but unfortunately there is a regression for other criteria. See bug 292497.
Comment 47 Volker Hemmann 2012-08-13 10:10:47 UTC
once upon a time, removing all filters and then creating new ones solved this for me.

Not anymore.

Seriously guys - bad enough that the migration to akonadi nuked my mails, that you need nepomuk for searching and everything is fucking slow compared to kmail1 - but no filtering?
Comment 48 Ivan Čukić 2012-08-22 08:51:36 UTC
Confirming it doesn't work in master.

Doing Ctrl-A Ctrl-J all the time when I enter my inbox.
Comment 49 Ivan Čukić 2012-08-22 09:27:54 UTC
Sorry, commented on a wrong bug
Comment 50 S. Burmeister 2012-08-22 09:47:42 UTC
This is a dup of bug 292497 . For a workaround see https://bugs.kde.org/show_bug.cgi?id=292497#c18
Comment 51 Thomas Arend 2012-08-22 17:51:02 UTC
This problem lives still in 4.8.5 but not so bad as before. When I receive a bunch of cron job mails - sometimes up to 1000 - only ~15% of the mails are not moved to the right folder. Applying the filter to all mails in the inbox does not work. When I select only same mails the filter works.

Same thing happens with spam mails.

This nasty behavior last since month. It seems a too hard task to get the filter working again. Must we accept the 85% solution?

Never change a running system!
Comment 52 S. Burmeister 2012-08-22 18:56:22 UTC
(In reply to comment #51)
> This problem lives still in 4.8.5 but not so bad as before. 

4.9.0 is current and includes a lot of fixes regarding filtering. So please try again with that version.

> When I receive a
> bunch of cron job mails - sometimes up to 1000 - only ~15% of the mails are
> not moved to the right folder. Applying the filter to all mails in the inbox
> does not work. When I select only same mails the filter works.

Any debug output from the filter logs and akoandi logs? Please only from 4.9.

> This nasty behavior last since month. It seems a too hard task to get the
> filter working again. Must we accept the 85% solution?

It's a matter of time. Do you have some spare time left to help?
 
> Never change a running system!

You were given the possibility to change it, i.e. upgrade, you changed it, nobody forced you to do so.

But if you are into smart phrases:

Stagnation equals death.

or

If you don't go forward, you go backwards.
Comment 53 Detlev Casanova 2012-08-28 20:40:29 UTC
Same problem here since the start of kmail2. I'll try to get some logs from kmail and akonadi as soon as possible.

Do you need anything else ? (trying patches is quite easy for me as I'm using Gentoo)
Comment 54 S. Burmeister 2012-08-28 21:29:24 UTC
If you are running openSUSE you can try the packages from the KR49 repo which includes a patch that should fix this issue.

Otherwise you can wait for 4.9.1 which will includes it as well.
Comment 55 Juergen Spitzmueller 2012-09-06 16:54:15 UTC
For me, the bug reappeared with KDE 4.9.1. According to the filter protocols, no filters are applied to incoming mails. Manually applying filters work.

The same setting worked without problems with KDE 4.8.x (I have skipped 4.9.0).
Comment 56 Detlev Casanova 2012-09-07 10:44:32 UTC
Still same here with KDE 4.9.1 :(
Comment 57 S. Burmeister 2012-09-08 10:53:42 UTC
Works for me with 4.9.1 openSUSE packages. Hence it's probably a config issue or a different bug which causes your trouble.
Comment 58 Thomas Arend 2012-09-12 18:04:12 UTC
Can confirm this bug. 

With update to 4.9.1 it is now worse than ever. Also selected mails - which definately fit the rule - are not filtered.
Comment 59 S. Burmeister 2012-09-12 19:06:46 UTC
Please do not add any "me too".

The only useful thing to add are ways to reproduce, including logs from akoandiconsole, after akonadictl restart in a konsole, info about the account type etc.

Are comment 8 and comment 20 still valid?
Comment 60 Thomas Arend 2012-09-15 12:27:18 UTC
Hello,

the update from 4.9 to 4.9.1 sets the target folder to "" for the operation move to folder in all filters. The destination folders are lost. Here is the part you get when you export your filters.
  
  action-args-0=
  action-name-0=transfer
  actions=1

This is not the case for other actions. 

Nearly all filters have a destination folder and 99.99% of my incoming messages are handled by these filters. This is why it looked as if no message was filtered. (The rule move to folder is there but the folder is NULL. Maybe this is the default for inbox).
   
This is good and bad news. Bad news is that there is some routine which destroys filters (this happens only to destination folders as far as I can see). Good news: Easy to fix manually when you know about it.

Second bad news: Filter don't work reliable! We will see this later. The filtering of incoming messages don't work with a new account.

I deactivated all but one filter and set the lost target folder. Manually filtering on selected messages worked. (You have to be a little bit patient, the update of the message list may need some seconds even on a very fast machine.)

Next time I activated a second filter. Filtering 970 messages (real world) in the inbox was surprisingly fast. (Never before saw such fast filtering, another good news, but there are enough bad left). All messages (42 fit the rule) were correctly filtered.

In the next step I received the outstanding messages from the server. 12 of 125 messages (cron job reports) which fit the rule cron-job rule (Criteria is "X-Cron-Env: <SHELL") were not filtered / moved to the destination folder. (Criteria is "X-Cron-Env: <SHELL") Even after some reasonable time the messages stayed in the inbox (Posteingang in my case).

Filtering all the left messages in the inbox manually moved the remaining messages cron-job-reports into the folder for the cron jobs. I have no reasonable explanation why the filter works only on 90% of the messages in the first run.

To test this I created an new account, created a filter (see export at the end) and send 1000 messages to the new account (kmail2test@example.com) with following command on the mail server.

for ((i=0 ; i<1000 ; i++))
do 
   echo test `printf %4.4d $i` |  mail -s "Filter Test `printf %4.4d $i`" kmail2test@example.com
done

When I received the messages no message was filtered and the filter log is empty.

I filtered some single messages. All worked fine. Filter log as you expect. Fine.

I filtered the rest of the ~ 995 messages. All but one (0948) were moved. #948 stayed in the "Posteingang".

This is the filter log entry:
[13:59:27] Applying filter action: Move Into Folder "Lokale Ordner/Posteingang/Filter Test Mails"
[13:59:27] Evaluating filter rules: (match all of the following) "Subject" <contains> "Filter Test"
[13:59:27] 1 = "Subject" <contains> "Filter Test" (Filter Test 0948)
[13:59:27] Filter rules have matched.

The log entry gives no hint why the message was not transfered. 1 of 1000 is better than 12 from 125 but not good enough. There must be a reason. Applying the filter manually move the message to the folder.

Below are the filter and message example.

Have a nice weekend
Thomas

--- Exported filter ---
[Filter #0]
Applicability=0
AutomaticName=true
ConfigureShortcut=true
ConfigureToolbar=false
Enabled=true
StopProcessingHere=true
ToolbarName=<Subject>: Filter Test
action-args-0=Lokale Ordner/Posteingang/Filter Test Mails
action-name-0=transfer
actions=1
apply-on=check-mail,manual-filtering
contentsA=Filter Test
fieldA=Subject
funcA=contains
identifier=T3iGHGAHWt9PDyjT
name=<Subject>: Filter Test
operator=and
rules=1

[General]
filters=1
---- end of filter ---- 

This is the first messages. (Please notice the violation of RfC 4155 by kmail2 in the From_ line; https://bugs.kde.org/show_bug.cgi?id=297198; this bug does not apply to kmail1)

--- begin received message ---
From thomas@arend-rhb.de Sat, 15 Sep 2012 13:19:54 +0200
Return-Path: <thomas@arend-rhb.de>
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on k2.arend.tksd
X-Spam-Level: 
X-Spam-Status: No, score=-0.0 required=5.0 tests=AWL,NO_RELAYS autolearn=ham
        version=3.3.1
X-Original-To: kmail2test@example.com
Delivered-To: kmail2test@example.com
Received: by k2.arend.tksd (Postfix, from userid 1000)
        id 0A84028BC4; Sat, 15 Sep 2012 13:19:54 +0200 (CEST)
Date: Sat, 15 Sep 2012 13:19:54 +0200
To: kmail2test@example.com
Subject: Filter Test 0000
User-Agent: Heirloom mailx 12.2 01/07/07
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <20120915111955.0A84028BC4@k2.arend.tksd>
From: thomas@arend-rhb.de (Thomas Arend)
X-UIDL: O>_"!;[F"!+G%#!TlA!!

test 0000


-- end of message ---

--- message no 948 ----
From thomas@arend-rhb.de Sat, 15 Sep 2012 13:20:11 +0200
Return-Path: <thomas@arend-rhb.de>
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on k2.arend.tksd
X-Spam-Level: 
X-Spam-Status: No, score=-0.0 required=5.0 tests=AWL,NO_RELAYS autolearn=ham
        version=3.3.1
X-Original-To: kmail2test@example.com
Delivered-To: kmail2test@example.com
Received: by k2.arend.tksd (Postfix, from userid 1000)
        id 06CE14F7F8; Sat, 15 Sep 2012 13:20:11 +0200 (CEST)
Date: Sat, 15 Sep 2012 13:20:11 +0200
To: kmail2test@example.com
Subject: Filter Test 0948
User-Agent: Heirloom mailx 12.2 01/07/07
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <20120915112042.06CE14F7F8@k2.arend.tksd>
From: thomas@arend-rhb.de (Thomas Arend)
X-UIDL: NKe"!1Q8"!@5?"!fJ(!!

test 0948
--- message 948 ---
Comment 61 Marcelo Sales 2012-09-16 16:52:06 UTC
I've just upgraded from 4.9 to 4.9.1 and have not lost the destination folders of my move filters, unlike what happened to Thomas (comment #60).
However, my filters were more or less working ok in 4.9, as long I kept them simple, with a single rule in each filter, and did not activate the anti-spam filters.
However, after upgrading to 4.9.1, all filters stopped working automatically, even the ones that only test a single condition and move messages based on that condition.
Now I have to select all messages in my inbox and use CTRL+J to start the filtering manually.
Comment 62 S. Burmeister 2012-09-16 17:21:00 UTC
If you add a comment please specify the account type (pop3/imap(online/offline)) and add the filter and akonadi logs.
Comment 63 Thomas Arend 2012-09-16 17:53:51 UTC
Created attachment 73964 [details]
Akonadi Log

This is the log file for the message receive 8pop3 account) There where 200 messages send and but I got 230 messages. Three where not filtered correct. The additional 30 result from messages which were twice or more times in the target folder.
Comment 64 Thomas Arend 2012-09-16 18:00:45 UTC
Created attachment 73965 [details]
Akonadi Log Information view

See the reports:
AgentBase(akonadi_maildir_resource_0): Die Nachricht „1347816734.R427.x1“ kann nicht verschoben werden.
AgentBase(akonadi_maildir_resource_0): Die Nachricht „1347816816.R722.x1“ kann nicht verschoben werden.
Comment 65 Thomas Arend 2012-09-16 18:01:46 UTC
(In reply to comment #62)
> If you add a comment please specify the account type
> (pop3/imap(online/offline)) and add the filter and akonadi logs.

I only use pop3 accounts.
Comment 66 S. Burmeister 2012-09-16 18:12:47 UTC
Could you search your email folder for the filenames that failed? Do they actually exist?

3 out of 200 hundred does not seem like a bug affecting most emails but something "special" which happens to a few.

What about those that report that no filters work anymore? Maybe they have some logs which show what causes 3 out of 200 for some and all emails for others not getting filtered.
Comment 67 Marcelo Sales 2012-09-16 19:43:34 UTC
Comment #61 is about POP3 accounts.
My filters are like this one:

[Filter #0]
Applicability=0
AutomaticName=false
ConfigureShortcut=false
ConfigureToolbar=false
Enabled=true
Icon=system-run
StopProcessingHere=true
ToolbarName=Lista: BovespaBrasil
action-args-0=779
action-name-0=transfer
actions=1
apply-on=check-mail,manual-filtering
contentsA=<BovespaBrasil.yahoogrupos.com.br>
contentsB={BovespaBrasil}
fieldA=List-Id
fieldB=Subject
funcA=contains
funcB=contains
identifier=RktTwRRigV3lRbS7
name=Lista: BovespaBrasil
operator=or
rules=2

If you want, I can post them all here, but they are all very similar to this one and were created right-clicking a message and selecting Create Filter -> Filter on discussion list NAME_OF_THE_LIST.  They do not work automatically when new messages arrive anymore, but they do work if I select all messages in my inbox and use CTRL+J.
I don't know how to see and save akonadi logs. Where do I find them?

Thanks
Comment 68 Thomas Arend 2012-09-17 15:52:17 UTC
(In reply to comment #66)
> Could you search your email folder for the filenames that failed? Do they
> actually exist?
> 
> 3 out of 200 hundred does not seem like a bug affecting most emails but
> something "special" which happens to a few.
> 
> What about those that report that no filters work anymore? Maybe they have
> some logs which show what causes 3 out of 200 for some and all emails for
> others not getting filtered.

This test installation is much better than real life. Today I had 10% or more of the real messages not filtered.
What makes it worst: Some deleted messages from Saturday and Sunday reappear. But this is another bug.

I'm not very happy with the idea to provide a full log of the real life messages.

In the log I found an entry saying, that the message could not be moved. That is a true and obvious information. It only gives the hint that the program tried to move but not why it failed to do so. 

What about more detailed information in the filter log to make the task a bit easier..

How can I relate the file names to the mails in the e-mail folder?

Can some body write a script to extract the needed information? This would be helpful to users not so familiar with kmail2 / akonadi.
Comment 69 Marcelo Sales 2012-09-17 21:26:04 UTC
Messages are being filtered automatically again after a reboot.
Comment 70 Patrick 2012-12-09 09:05:44 UTC
This bug appears to be valid in kmail2 4.9.4. I've got multiple mail accounts (POP3), all with their own inbox folder. I've setup a filter which moves certain messages from one of the accounts' inbox into a subfolder of the inbox folder. This filter should trigger on incoming messages, but it fails to do so. It only works manually on 'apply filter'.
Comment 71 Graeme Hewson 2012-12-17 18:26:49 UTC
Automatic filtering doesn't work on local mbox or maildir accounts.

I set up a filter to move incoming messages to a different folder. When I use mailx to send myself a test message, the message appears in the incoming folder and isn't moved, and nothing shows in the filter log. The filter works fine when applied manually.

Reproducible always. Kmail 4.9.4.
Comment 72 Thomas Arend 2012-12-18 17:11:51 UTC
(In reply to comment #71)
> Automatic filtering doesn't work on local mbox or maildir accounts.
> 
> I set up a filter to move incoming messages to a different folder. When I
> use mailx to send myself a test message, the message appears in the incoming
> folder and isn't moved, and nothing shows in the filter log. The filter
> works fine when applied manually.
> 
> Reproducible always. Kmail 4.9.4.

For me this partly right. I received some hundred mail a day (outputs of cron jobs) and spam. Some mails are filtered some are not. At the moment ~10% of the mails are not filtered.
Comment 73 Kyrylo Bohdanenko 2012-12-19 00:20:19 UTC
I use Kmail 4.9.4. I would like to admit:
1. Go to "Inbox" (or some other) folder
1b. Make sure you have some messages that match filters
2. Select all mails in the foler (e.g. press Ctrl+a)
3. Run message filters (e.g. press Ctrl+j)

Expected results:
Filters are applied to all selected messages

Actual results:
Filters are applied only to some messages (sometimes some == 0). I mean that not all (selected) messages that  match filters are filtered.
Comment 74 Bernhard Jungk 2013-01-11 19:42:21 UTC
I think I have the same, a similar problem. I have set up several filters to move messages to separate folders. Sometimes an incoming mail is filtered, sometimes not. Applying the filter manually usually helps. This could be annoying. 

Furthermore I don't understand why filtered/moved messages show first up in the inbox folder after all. This was working much better with the old kmail.
Comment 75 Thomas Arend 2013-01-11 22:46:49 UTC
(In reply to comment #74)
> I think I have the same, a similar problem. I have set up several filters to
> move messages to separate folders. Sometimes an incoming mail is filtered,
> sometimes not. Applying the filter manually usually helps. This could be
> annoying. 
> 
> Furthermore I don't understand why filtered/moved messages show first up in
> the inbox folder after all. This was working much better with the old kmail.

I confirm that all messages show up first in the inbox. It seem that they are sorted first to the inbox and the filters are applied later. I would expect that an incoming message is parsed by the filters first. I get some hundred messages a day. Parsing first would save a lot processing power.
Comment 76 András Manţia 2013-01-12 07:50:17 UTC
Showing the messages first in inbox is a limitation of the current architecture. The filters act when messages appear in a certain folder, namely folders marked as inbox. There is no way at the moment to apply filters *before* mails are put in a folder.
Comment 77 S. Burmeister 2013-02-04 17:55:38 UTC
bug 311199 explains a method to generate lots of emails for the imap inbox which apparently triggers the "some mails are filtered, some mails are not" bug.
Comment 78 Thomas Arend 2013-02-04 18:49:14 UTC
(In reply to comment #77)
> bug 311199 explains a method to generate lots of emails for the imap inbox
> which apparently triggers the "some mails are filtered, some mails are not"
> bug.

I thought I had explained it long ago in another bug. But here is the easy way:

for ((i=0;i<1000;i++;)); doe echo "Test" | mail -s "test $i" you@yourdomain.tdl ; done
Comment 79 Thomas Arend 2013-02-04 18:51:56 UTC
Upps it was in this bug some comment above.
Comment 80 András Manţia 2013-02-28 08:25:28 UTC
Fixed in KDE 4.10.1 and later by Wolfgang Rohdewald.
http://commits.kde.org/kdepim/185c572e079ef40bee2225e582c11dbdbb35840f
Comment 81 Sven Wünschmann 2013-05-16 12:36:07 UTC
(In reply to comment #80)
> Fixed in KDE 4.10.1 and later by Wolfgang Rohdewald.
> http://commits.kde.org/kdepim/185c572e079ef40bee2225e582c11dbdbb35840f

Does not work for me. Using Kubuntu 13.04, KDE 4.10.2.

Setting:
- POP3 Mail account used for mailing lists, mails go to local folder -> inbox on default.
- Filters definded to move mailing list mails into local folders for the dedicated list

Result:
- All mails remain in local folder -> inbox.
- when manual filtering is used (ctrl + j), mails are moved to the defined foldres
Comment 82 Kevin Funk 2013-05-16 17:42:39 UTC
Works for me reliably, same configuration (Kubuntu 13.04).
Comment 83 Sven Wünschmann 2013-05-17 08:23:50 UTC
This morning it is working for me as well. Yet, I have not changed anything...

I will have a more detailed look at the "Mail Filter Agent" in the Akonadi Console if filtering stops to work again.
Comment 84 Adrián Chaves (Gallaecio) 2013-05-18 19:07:31 UTC
KMail 4.10.3 and still not working here.
Comment 85 Sven Wünschmann 2013-05-19 12:23:49 UTC
Today, filtering was missing again.

Could the issue be based on "undefined" startup bahavour? What if mails are alread fetched and the "mail filter agent" is not already up and running but still starting up?
Comment 86 Adrián Chaves (Gallaecio) 2013-05-19 13:01:07 UTC
My computer is on 24/7, so I don’t think this is because of the mail filter agent not being ready yet. Also, this does not happen sometimes to me. No List-ID-based filter has ever worked here on incoming emais (they work when applied manually), to the point where I have modified half of them to work based on the To field instead (which does work), and those I did not change I kept so that I can provide feedback here.

Also, yesterday I edited one of the List-Id-based filters to apply to only selected accounts (and selected my IMAP account), since somewhere in this report it was mentioned that such option (which is by default “apply to all accounts”) might have something to do with this issue. However, today I got mail that should have been filtered by the modified filter, and it wasn’t.
Comment 87 Frank Souza 2013-05-29 07:56:19 UTC
Same here. KMail 4.10.3, I'm trying to apply marks with filters, but also do not see working.
Comment 88 András Manţia 2013-05-29 19:26:50 UTC
Works for me (also for List-Id) since I originally fixed the bug - all mails are filtered - , so those who have problems should give me more information, like:
- the exact filters (basically the filter rules file with sensitive info replaces by some string, like XXXX)
- detailed description about the account types used
Comment 89 Adrián Chaves (Gallaecio) 2013-05-29 19:46:26 UTC
Created attachment 80168 [details]
Filters configuration file.

Attached the content of my “.kde4/share/config/akonadi_mailfilter_agentrc” file, which I guess is what you are asking for. I’m not sure of what other details my be of help.

PS: I didn’t bother to hide information, I sell my privacy cheap ;)
Comment 90 András Manţia 2013-07-09 21:09:22 UTC
For those still having the problem, can you check in the advanced tab that the filter is enable for ALL accounts? If not, and the filter in question does not work for POP3 you might see bug 308008.
Comment 91 András Manţia 2013-07-09 21:12:20 UTC
Adrian: none of the List-Id based filters work for you? As I see you are using an IMAP account, is it disconnected imap or online imap?
Comment 92 Adrián Chaves (Gallaecio) 2013-07-09 21:49:42 UTC
I guess it is online IMAP, as the “Enable offline mode” option under Advanced is not checked. It does happen with any List-Id-based filter.

I’m actually in a different computer right now, with a different system (my PC is Chakra, I’m currently on a Kubuntu with the KDE SC 4.10.4), and I’ve been able to reproduce teh issue easily. I just added a List-ID-based filter for KDE PIM messages, filtered all mail manually, and it works, but new KDE PIM emails do not get filtered as they are retrieved.
Comment 93 Graeme Hewson 2013-09-18 16:10:37 UTC
Filtering has been much better for me in the last few releases, but I've hit a one-off problem.

I filter messages from a particular mailing list to its own folder. A little while ago I did a manual Check Mail (Ctrl+L), and two new messages from the list were left in my Inbox. These were correctly filtered with a manual Apply Filter (Ctrl+J).

A few minutes later I again did a manual Check Mail, and two new messages from the list were correctly filtered and moved out of my Inbox.

This is a POP3 account, and the filter looks at List-Id. The filter is applied just to the particular POP3 account (since bug 308008 was fixed).

I guess it would be tricky to reproduce this, as the timing would have to be just right (or wrong).
Comment 94 Graeme Hewson 2013-09-19 09:54:58 UTC
Following on from my comment 93, now a message has been left in my inbox after an automatic mail check. Again, the message was moved to the correct folder after applying filtering manually.

So this is more than a one-off, but an intermittent bug, and can occur with automatic or manual mail checks. I'm on 4.11.1, using the Kubuntu PPA.
Comment 95 Graeme Hewson 2013-09-20 11:16:20 UTC
Created attachment 82421 [details]
Filter log showing filtering applied twice to same message
Comment 96 Graeme Hewson 2013-09-20 11:19:15 UTC
I've hit another problem, which seems to be a timing problem, maybe tickled by the fact that I've now turned on filter logging.

After reading a message in the mailing list I went back to my inbox and saw what turned out to be the same message (I saved the two copies and compared them to make sure). From both the inbox and the other folder, I was able to save the message, but there was only one copy on disk, which I found using grep. This was in ~/.local/share/.local-mail.directory/inbox/new/ (before I opened it).

I've uploaded the relevant part of the filter log (https://bugs.kde.org/attachment.cgi?id=82421). The entries at 08:07 and 08:37 are just for context, to show that I've included all entries at 08:27. The log entry for the first message at 08:27:12 says "Move Into Folder "akonadi-local/london.pm", and indeed that message was visible in that folder through kmail, but as I say, grep showed it was really in inbox. The timestamp of the file (using ls --full-time) is 08:27:12.79. Now see the filter log entry at 08:27:13. This refers to the same message that was filtered one second earlier (I know it's the same because there was only one message sent by that person at 09:07 their local time).

After manually applying filtering to the message, the two (visible) copies were both in akonadi-local/london.pm. Again, there was only one version actually on disk.

About an hour later, the same thing happened (same mailing list; different author).
Comment 97 abin 2014-03-25 18:11:11 UTC
Same problem with kmail 4.11.4 on mageia 4.
Comment 98 Frank Souza 2014-03-25 18:19:19 UTC
Same here, 4.12.3 on Ubuntu ( Ubuntu + KDE ppa backports) 12.04.3
Comment 99 Graeme Hewson 2014-04-21 09:44:13 UTC
Still happening in 4.13. I think this is the same as bug 293918.
Comment 100 forums.encelade 2014-07-03 14:31:36 UTC
kmail 4.8.5, using KDE development Platform 4.8.5, installed by apt-get

A simple mail filter, (anywhere in the headers contains 'some string'), move into a folder refuses to work.  I cleaned up the filter logging yesterday pm.  A mail (which should have been filtered) was sent around 00:07 (gmt+2).  The computer was online at that time..

went to sleep, awakened the computer around 11:00.  Around 15:30, still seeing the mail in the inbox) i looked at the filter log (everything enabled, no limits).  Nothing done since yesterday !

I selected all messages in the inbox, requesting to apply the filters, and the filter was applied (as usual when i request manual filtering).

Any idea ?
Comment 101 Tsaros 2015-05-24 20:01:11 UTC
I downloaded linux mint kde 17.1 64b and kmail is not applying rules to the incoming mail.
Comment 102 Tsaros 2015-05-25 05:42:01 UTC
Will this ever be fixed? Its important for a corporate enviroment.

Thank you.
Comment 103 Sand 2015-06-17 01:46:43 UTC
Kmail filters dont work in incoming mail

kmail-4.14.8
Comment 104 Eric 2015-06-17 17:50:16 UTC
Hello,
Kmail2; 4.14.8; Linux (x86_64) release 3.16.7-21-desktop; cc

I have about 7 imap account, and a good 30 filters.

Ctrl+J works when I select 1 email already in my inbox.

But it doesn't work on incoming emails ....
Comment 105 Alexander Potashev 2016-01-22 14:18:08 UTC
I confirm this bug with KMail 4.14.10 on Fedora 23.
Comment 106 Tom Mittelstädt 2016-01-23 09:42:18 UTC
maybe related: https://bugs.kde.org/show_bug.cgi?id=358041
Comment 107 Tom Mittelstädt 2016-01-31 11:58:04 UTC
Maybe the importance should be increased as this can lead to data loss.
Comment 108 Tom Mittelstädt 2016-01-31 12:06:02 UTC
Modifying the filter rule seems to fix it for a couple of days.
Comment 109 Metko 2016-03-30 11:32:11 UTC
When kmail (5.1.2) is started after login (Leap 42.1), no filter is applied and all new emails remain in the inbox folder (very annoying). Even manual filtering and Ctrl+J don't work. My standard procedure then is to just open the filter settings dialog (Einstellungen|Filter einrichten...) and close it immediately with Ok, i.e. without changing anything. From then on filtering works as expected. It seems like the whole filtering mechanism is only started upon firing up the configuration dialog. Couldn't find this in the previous comments, so maybe it's a clue for the developers.
Comment 110 Hatto Von Hatzfeld 2016-05-02 18:52:28 UTC
May be related: https://bugs.kde.org/show_bug.cgi?id=362599
Comment 111 Tom Mittelstädt 2016-05-02 19:50:24 UTC
Metko exactly describes  the behavior here.
Comment 112 Holger 2016-06-08 19:24:25 UTC
Hello, I also can confirm the behavior described by Metko. Any update on this issue? Anything I can provide from my side? 
Thanks!
Comment 113 Sven Eden 2016-06-21 12:54:49 UTC
I just came across this.

Normally it was enough to fire up akonadiconsole, restart the mail filter agent, and then quickly start kontact.

Not today.

When, for the umpteenth time, the mail filter was stuck at 0%, I opened the akonadiconsole, and selected "Abort Activity" on the mail filter agent.
And it immediately began to filter the 1,046 mails I had selected.

So it seems, that the filter agent got ordered to do something else before answering my request and got stuck on that, and not the requested filtering itself.

It is slow right now, because I had activated the filter log, but at least it works again.
Comment 114 Sven Eden 2016-06-23 05:50:36 UTC
Update on my previous report:

After the mail filter finished, it got stuck at 100%. The akonadi_mailfilter_agent process used 100% CPU, and was neither interruptible nor stoppable using akonadiconsole.

I quit kontact, shut down akonadi and even logged out and back into plasma, but the process remained until I killed it.

After that it worked just fine yesterday.

Today I wanted to filter some mails and it just started at 100% and was stuck again until the process got killed.

I tried several times, with kontact and akonadi restarting in between, but always ended up killing the akonadi_mailfilter_agent.

Then, all of a sudden, a myriad of status windows popped up, all with the filter being at 100%, but eventually it started its work regularly.

If I had to guess, I'd think the filter has at least one race condition and a problematic endless loop somewhere. Didn't look up the sources, though...
Comment 115 Pal Körössy 2016-11-04 07:28:35 UTC
I had the same problem with OpenSuSE 13.2 KDE 4.14, and also remembering it came after installing some updates.
Now after removing some update packages and downgraded to the following original packages, filtering is working again:

libakonadiprotocolinternals1|1.13.0-2.2.3
python-kde4|4.14.2-1.1
libakonadi4|4.14.2-1.1
akonadi-runtime|1.13.0-2.2.3
python-kde4-plasma|4.14.2-1.1
python-kde4-phonon|4.14.2-1.1
python-kde4-knewstuff|4.14.2-1.1
python-kde4-khtml|4.14.2-1.1
libkdepimlibs4|4.14.2-1.1
python-kde4-akonadi|4.14.2-1.1
libkdepim4|4.14.2-1.1
kdepim4-runtime|4.14.2-1.1
kalarm|4.14.2-1.1
akregator|4.14.2-1.1
plasma-addons-akonadi|4.14.2-1.1
akonadi|4.14.2-1.1
kdepim4|4.14.2-1.1
korganizer|4.14.2-1.1
kontact|4.14.2-1.1
knotes|4.14.2-1.1
kmail|4.14.2-1.1
kaddressbook|4.14.2-1.1
Comment 116 quazgar 2016-11-14 08:21:22 UTC
Very similar here, after rebooting the computer, filtering consistently does nothing.  Restarting the Akonadi server always makes filtering work again.

Debian testing here, Kontact, KMail and Akonadi are all at version 16.04.3-2.
Comment 117 quazgar 2016-11-14 08:24:37 UTC
(In reply to quazgar from comment #116)
> Debian testing here, Kontact, KMail and Akonadi are all at version 16.04.3-2.

Sorry, that was the Debian version, of course.  Kontact says it's 5.2.3, Akonadi is at 5.2.2.