Bug 59685 - Want the filter to work with IMAP folders
Summary: Want the filter to work with IMAP folders
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR wishlist with 625 votes (vote)
Target Milestone: ---
Assignee: Don Sanders
: 60283 63298 70579 86299 87353 103099 (view as bug list)
Depends on:
Reported: 2003-06-12 11:55 UTC by Fred
Modified: 2009-12-06 16:59 UTC (History)
15 users (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Fred 2003-06-12 11:55:25 UTC
Version:           1.5.2 (using KDE 3.1.2)
Installed from:     (3.0)
Compiler:          gcc version 2.95.4 20011002 (Debian prerelease)
OS:          Linux (i686) release 2.4.18-FMD4

Arg, there are a lot of bugs report that show that we are a lot who want to use filter with IMAP folders.
Ok, it is 'bad' to download the mail twice, but, if we need it !!!
I use mozilla for that, but it is ugly to have a mozilla in a 99% KDE system (and kmail is so nice!)

Marc, you said that we have to program in sieve to perform filters in the server-side, but that it is very limited (and i've just spent an hour for searching a way to do that without success, and i've not access to the company's server). 
So, why can't we benefit from the power of kmail filters?!?
Just add a comment saying that this kind of filters may slow-down the network, but PLEASE, let us use it!!!

Thanks in advance.

Comment 1 Carsten Burghardt 2003-06-12 14:03:41 UTC

*** This bug has been marked as a duplicate of 50997 ***
Comment 2 Fred 2003-06-12 14:23:54 UTC
Ok, it may be cool for some users to filter IMAP mails into their local storage,
but I want my emails to STAY ON THE SERVER!
It's the goal of IMAP, and like this, we can have our emails backed up and
accesible from anywhere.

So, my report IS NOT A DUPLICATE.

I still want to be able to apply filters to mails from IMAP, and sort them into
my IMAP directories...

It would be so great!

(by the way, thanks for treating my report so quickly!)
Comment 3 Ingo Klöcker 2003-06-13 00:56:36 UTC
Subject: Re:  Want the filter to work with IMAP folders

Carsten was right. This wish is basically a duplicate of 50997. Both are 
about client side filtering of messages in IMAP folders. Whether you 
want to move them to other IMAP folders (as in your wish) or whether 
you want to move them to local folders (as in 50997) doesn't really 
matter from the developers' point of view.

Comment 4 Fred 2003-06-13 08:33:26 UTC
Exept that the functionnality of moving mails to local folders is implemented,
but not the 'move to IMAP folders'.
So my wish!
I think it may not be very difficult for the kmail team to add this function,
that would enable a lot of us (all who work in IMAPed companies) to leave
mozilla and switch (at last!) to kmail!!!
Comment 5 Ingo Klöcker 2003-06-23 23:25:39 UTC
*** Bug 60283 has been marked as a duplicate of this bug. ***
Comment 6 Alisson Sellaro 2003-08-05 15:17:07 UTC
Is there a position concerning implementation of this feature? 
Comment 7 bo 2003-08-05 15:21:21 UTC
Subject: Re:  Want the filter to work with IMAP folders

Search the kmail@kde.org mailing list archive for several threads on the 


Comment 8 Don Sanders 2003-08-06 06:33:13 UTC
Subject: Re:  Want the filter to work with IMAP folders

On Tuesday 05 August 2003 23:17, Alisson Sellaro wrote:
> ------- Additional Comments From sellaro.kde@mailnull.com 
> 2003-08-05 15:17 ------- Is there a position concerning
> implementation of this feature?

I'm intending to implement it as time permits, preferably while 
sitting down 

It might take a bit of creative thinking, due to the synchronous 
architecture of the filtering code. Well I already made mail 
retrieval and sending async, so I guess filters can be asynchronized 
also if necessary.


Comment 9 Patrick Cornelissen 2003-08-19 10:13:05 UTC
Please do so.
The only thing that keeps me at Mozilla-Mail is IMAP filtering. I get ~100
messages/day and I don't want to filter them by hand...
(Wild guess: Maybe I can open both programms and only use kmail, while mozilla
is filtering the mail in the background)
Comment 10 Ingo Klöcker 2003-08-27 15:30:49 UTC
*** Bug 63298 has been marked as a duplicate of this bug. ***
Comment 11 Thomas Haenig 2003-08-27 15:54:22 UTC
We use server side filters, but if a incoming mail is moved to another folder (especially SPAM  
which I want to have a briefly look over once a week or so) I am not able to mark it e.g. as read  
(by a filter).   
Every single mail shows up as 'new'. Thats why I want to have client side filtering too.   
My wish (63298) has been marked as a duplicate of this, so I want to make clear, this is 
important for me 
Comment 12 Ingo Klöcker 2003-12-16 16:35:04 UTC
*** Bug 70579 has been marked as a duplicate of this bug. ***
Comment 13 Hans-Peter Zahno 2004-02-16 17:20:16 UTC
Receiving 100 and more mails a day, filtering is a MUST for me. Without filtering on IMAP-Folders IMAP is nearly useless for me. And I don't like to run every morning first Mozilla to get my IMAP-Folders filtered :-(

Thanks for adding this feature!
Comment 14 Matej Cepl 2004-02-16 18:48:15 UTC
Use Disconnected IMAP instead of regular IMAP -- kmail 1.6 has no some 50 filters for me, which work over my dIMAP account.
Comment 15 Harald Nikolisin 2004-02-18 10:46:58 UTC
I lost the overview about this topic.
Is the feature "automativ move from IMAP Inbox to another IMAP folder with filter" yet implemented in kmail 1.6 or is it scheduled for the next major release, or is it not possible to implement in the near future?
Comment 16 Matej Cepl 2004-04-07 18:14:21 UTC
AFAIK (and I have still just KMail 1.6 from KDE 3.2) the answer is that it works with dIMAP, but not with pure online IMAP.
Comment 17 Don Sanders 2004-08-19 09:17:26 UTC
*** Bug 87353 has been marked as a duplicate of this bug. ***
Comment 18 Don Sanders 2004-08-26 10:57:18 UTC

Does anyone object to updating the filter dialog to support multiple 
selection support? Specifically I mean changing kmfilterdlg.*, so 
that the selection mode of the mListBox is set to Extended. And 
making sure the rest of the code is updated to work after that 

I would like to do make this change because it could improve the 
quality of the filter dialog, and because it seems to be a nice basis 
for the GUI work on client side IMAP filtering improvement I'm 
currently working on.

This change could improve the quality of the filter dialog for two 
main reasons. Firstly it would allow multiple filters to be 
moved/deleted simultaneously. (I recall requests for this but don't 
remember a bug number). Secondly while the Filter Criteria and Filter 
Actions groupboxes would have to be disabled when multiple filters 
are selected all of the controls in the advanced group box could 
still be used. This last point requires further explanation.

I'm not sure there's an equivalent in KDE, but on OS X I quite like 
the font dialog in the Apple TextEdit application. This dialog uses 
tristate checkboxes, so for instance if I select a paragraph 
containing bold and normal text, the bold checkbox will be shown in 
the third blank/unknown/ambiguous state. Then the boldness of the 
entire selected paragraph can be changed by clicking on the bold 

I think this is actually quite an elegant/nice/simple UI idiom and can 
be applied to all of the advanced options in the filter dialog. That 
is all the apply this filter, stop processing here, and add filter to 
the menu checkboxes could be applied to multiple (selected) filters. 
Perhaps this is also true of the 'Icon for this filter' button.

Finally and most importantly, for client side IMAP filtering I would 
also like to add a 'for this account' combobox in the advanced 
options section immediately below the 'apply this filter' checkboxes. 
This is so that the apply this filter checkboxes (incoming, outgoing, 
manual) can be specified on a per account basis, (and so that I don't 
need to force a change of behavior for existing users when adding 
client side IMAP filtering).

Now having multiple selection support in the filter dialog will be 
useful as it will allow users who want to enable client side IMAP 
filtering to select their IMAP account in the proposed new 'for this 
account' combobox then select all their filters and with a single 
checkbox toggle all their filters on (or off) for their selected IMAP 
account (for incoming/outgoing/manual filtering).

I hope that makes sense. I discussed it with Till on IRC and he is 
supportive of the idea. I can attach a screenshot if it would help. 
Previously I've added/improved multiple selection support to the list 
of headers widget and the search dialog, I think that went ok.

If there are no objections (nice) then I'll work on a patch to send to 
the list.


Comment 19 Don Sanders 2004-08-29 10:45:55 UTC
On Friday 27 August 2004 03:28, Ingo Kl
Comment 20 Daniel Lipsitt 2004-08-29 17:21:52 UTC
"As I said the multiple selection idea is just about making it easier for existing users to upgrade."

I haven't been reading this thread carefully because I'm in the middle of moving to a new apartment, but this sentence set off bells in my head. If you are proposing adding something complicated to an everyday function in order to allow what is likely to be a one-time activity, perhaps you should split it off into a separate dialog. Something along the lines of "upgrade my filters for use with IMAP."
Comment 21 Don Sanders 2004-08-31 10:55:06 UTC
On Tuesday 31 August 2004 07:28, Ingo Kl
Comment 22 Don Sanders 2004-09-16 10:58:41 UTC
I've implemented the visual filter dialog changes discussed with Ingo, 
and created two tabs, a general tab 
( http://invertedlogic.com/generaltab.png ) and an advanced tab 
( http://invertedlogic.com/advancedtab2.png ) 

The next step is to change KMFilter to allow filters to be enabled for 
selected accounts only, check/ensure that the asynchronous filtering 
system (action scheduler) that was designed last year is still 
working, and then migrate at least the imap account type to use the 
action scheduler.


Comment 23 Jason Keirstead 2004-09-27 13:11:05 UTC
*** Bug 86299 has been marked as a duplicate of this bug. ***
Comment 24 Matthew Bevan 2004-10-12 10:46:39 UTC
For some strange reason I'm thinking of a simple solution to this problem:
Add a new filter option: Account received from matches (insert account dropdown list here, with 'any' selected by default).

To solve the synch. issues, have a filter queue which checks against mail headers (optionally downloading a complete copy of the message if required by a whole-message search) and enqueueing the appropriate action.  Once "filtering" is complete, process the actions, then re-sync the mailbox.

I.e. User hits check mail, it downloads the latest listing for the IMAP inbox, detects 'unseen' messages, downloads all relavant headers, runs filters (downloading message bodies as nessicary), makes changes to local copies as if the user had enqueued the move/copy/whatever events (with possible downloading of bodies and uploading), and synchronizes changes to the inbox and any effected subfolders.

Rinse. Repeat.

Being able to filter IMAP e-mail into other IMAP e-mail boxes is a must for me - I'm away for the weekend and I have 250 messages in my inbox which I have to filter by hand, currently.
Comment 25 Mikhail Ramendik 2004-11-23 00:58:20 UTC
There is one more use case for this feature, apart from those already listed here.

One can receive mails on a POP account, but use a local (or LAN) IMAP server for storage of certain mails (i.e. mailing lists). I use DbMail on my local machine for the purpose.

I'd really like an ability to filter my POP mails into the folders on an IMAP account. This seems to be something covered by this bug as well.

Of the open source mailers that I know, only Evolution currently has this working (but I don't want to use it for other reasons).
Comment 26 Don Sanders 2004-12-27 09:32:19 UTC

Here is a status report concerning the work we are doing, on making the 
filters work with imap folders so that mail may be filtered into imap folders 
59685. So that new mail in imap folders is automatically filtered 50997, and 
in making filtering mails into external tools like spam assassin 
non-blocking, a.k.a, asynchronous 41514.

Firstly I want to say that I'll close 41514 once I'm satisfied that filtering 
mail into an external tool like spam assassin no longer blocks for lengthy 
periods. Could people who have some other blocking problem please open up a 
new bug rather than comment on 41514 as commenting on 41514 will result in 
their feedback being forgotten when 41514 is closed.

What has been achieved in the last month? There is now a functioning prototype 
of KMail enhanced to support all the improvements listed above working in my 
laboratory at home where I work on a machine disconnected from the internet. 
I have also started using this system on my production machine at work. 
However I'm encountering problems just as fast as I can fix them so I 
anticipate it will take some time before things stabilize enough to commit 
the code to cvs. I apologize for this delay.

There is also a complication in that only mail manually filtered with 'Apply 
Filters', and incoming IMAP mails are currently being filtered using the new 
filtering system. Local, POP, and Sent mails (and disconnected) are still 
being filtered with the old filtering system. This means that mails filtered 
from these kinds of accounts can't be filtered/moved into imap folders (even 
though that appears as an option in the filter dialog).

I've promised not to address Local, POP, and Sent mails, before completing a 
'Quick insertion of common phrases' feature. Thus it seems necessary for me 
to now work on asynchronous filtering, imap folder targets, automatic 
incoming imap mail filtering, and quick insertion of common phrases 
simultaneously. Which is what I plan to do in the following weeks.

If people are interested in the details of the currently known bugs they are:

POP, Local, Sent (and disconnected?) accounts need to be ported over to using 
the action scheduler.

Need to automatically check imap inboxes when new mail is discovered in them. 
Currently need to manually kick of filtering by changing into an imap inbox.

I don't have any logic for handling crashes. Mail shouldn't be lost but in the 
event of a crash some mail may not be filtered.

Somewhere in the networking stack below KMail (KIO or the IMAP server I'm 
using in my lab) there is a problem that is causing a lot of timeouts and this 
means some mails are not being filtered.

I'm only about half way through my tests, I'm currently still in the stage of 
encountering new problems just as fast as I fix the old ones.

Finally I'd like to say thank you again to all the people who are funding the 
development of these features for all KMail users, through the commercial 
improvement system. We really appreciate your support.

Don Sanders

Comment 27 steven 2005-01-10 02:39:18 UTC
I'm really glad someone is working on this, as I had been using Thunderbird, but didn't have a calendar program (Sunbird isn't quite there yet), so I thought I would switch over to Kontact suite. That's when I discovered that I couldn't filter IMAP messages to IMAP folders. Which pretty much means I'm back to using Thunderbird for the time being...

Thanks to all who are working on this feature. Everything else in the Kontact suite looks really great. I can hardly wait to swith over as soon as this feature is done.
Comment 28 Mathieu Jobin 2005-03-17 00:27:18 UTC
could this filter feature just list the filter stored on the server and allow to modify them ?

there is probably a few standard way to specify imap filters on a server.... kmail should simply be a frontend.

Comment 29 Matej Cepl 2005-03-17 00:52:02 UTC
To #28: take a look at http://josefsson.org/kio_sieve/ (be aware that this has nothing to do with KMail whatsoever) and http://www.cyrusoft.com/sieve/. However, there are two problems: most mail servers I have every heard of have Sieve either switched off, the server software doesn't support it, or users are not allowed to use it. The second problem is that its use is really not trivial (so far -- if somebody creates equivalent of KMail filter editor, which will generate Sieve on background, the situation would be better). And last but not least -- http://bugs.kde.org/show_bug.cgi?id=55313 and http://www.linuxplanet.com/linuxplanet/tutorials/5707/2/ claims that "On the Filtering tab you can tell KMail to use your Sieve filters, if you have any." Unfortunately, I have not an opportunity to try it and documentation is sorely lacking in this respect.
Comment 30 Jason Vas Dias 2005-04-02 22:59:31 UTC
Now that in kmail-1.8, the "Move To" option nicely lets you move mail
between IMAP folders, it really shouldn't be that difficult to provide the
same functionality for the "Move Into Folder" filter action .
I don't care if the filter is stored on the server, or if kmail must first
download the mail and then upload it to the server if it matches a filter .
I get over 500 mails a day which I don't want to store in local folders.
The lack of the ability to specify filter actions to move mail into IMAP
folders is the only reason I can't use kmail as my main mailer and have
to use evolution. 
Can't we just re-use the functionality of the "Move To" option in the
filter action ? I'm going to investigate doing this.

Comment 31 Jonathan Hutchins 2005-04-03 00:59:22 UTC
On Saturday 02 April 2005 02:59 pm, Jason Vas Dias wrote:

> ------- Now that in kmail-1.8, the "Move To" option nicely lets you move
> mail between IMAP folders, it really shouldn't be that difficult to provide
> the same functionality for the "Move Into Folder" filter action .
> I don't care if the filter is stored on the server, or if kmail must first
> download the mail and then upload it to the server if it matches a filter .
> I get over 500 mails a day which I don't want to store in local folders.
> The lack of the ability to specify filter actions to move mail into IMAP
> folders is the only reason I can't use kmail as my main mailer and have
> to use evolution.
> Can't we just re-use the functionality of the "Move To" option in the
> filter action ? I'm going to investigate doing this.

Please, let me second this, it is -exactly- what I am asking for.

If we need to seperate this request from the server-side-filtering request 
then let's do so, it was combined by the development team, who may not have 
understood the difference.
Comment 32 Andreas Gungl 2005-07-18 21:48:45 UTC
*** Bug 103099 has been marked as a duplicate of this bug. ***
Comment 33 Don Sanders 2005-07-19 02:19:33 UTC
I've posted an update to Bug#50997 that is relevant to this bug also.

I've attached a patch to that bug that implements support for imap folders
as targets of filters for online imap accounts.

Don Sanders http://donsanders.org
Comment 34 Don Sanders 2005-08-22 13:29:07 UTC
I've now submitted patches to support filtering of incoming mail for online IMAP accounts and so that online IMAP folders can be used when filtering into folders, so I'm finally closing this bug.

There are still a wide spectrum of potential issues, too many for me to enumerate here, but (excepting unforseen problems) the online IMAP filtering functionality should be fully operational in the KDE 3.5 release!

As an additional benefit, online IMAP account users should benefit from more asynchronous filtering including non-blocking spam filtering (thanks to Till Adam's work). I hope to port other accounts types over to this new filtering system to address bug#41514 but currently more asynchronous filtering is only supported for online IMAP accounts (and manual filtering).

If bugs are found in the online IMAP filtering instead of re-opening this bug please open up a new bug report with a specific description of the problem and if at all possible a method for (someone other than yourself) to reproduce the problem.

Finally I'd like to once again thank the supporters of the commercial improvement system, in many ways it is their encouragement that has helped make the implementation for this improvement possible. Thank you!

Don Sanders http://donsanders.org