KMail – filtering from Pop to Imap?

October 28, 2007 at 5:38 am | Posted in KDE | 8 Comments

Just got my lost mail back. Apparently it was just moved into one of the existing subfolder and by simple accident I found the. After some reshufling of the mails I wanted to switch from fetchmail+maildrop to KMail filtering.

Unfortunately it turns out that KMail doesn’t support moving mails into an IMAP mailbox automatically, at least that what it tells me when I setup a spamfilter which should move spam into an IMAP box of my local mailboxes.

A little background: I’ve setup a small IMAP server to be able to use KMail as well as MuttNg on the same mailboxes. AFAIK its not possible to share mailboxes between KMail and another program because KMail uses extra index files to keep track of certain information about the mails (I’m using maildir’s btw.). And I need MuttNg when accessing my laptop via ssh, so thats why I’m using IMAP to access local mailboxes.

So if anybody has an idea how to fetch mail from a pop3 account, run it through some filters in KMail and put them into various IMAP mailboxes depending on the filtering result I’d appreciate a comment.

PS: Reasoning to switch to KMail also for fetching/filtering is that I’d like to use the “only store mails for XX days” feature so my mailinglist folders don’t get too crowded.

Edit:Seems like the “only store mails for XX days” feature works with the creation or modification times instead of looking at the Mailheaders. Not very good, as due to the reshuffling all mails have a modification time from last night😦

8 Comments

  1. Leave KMail out of the filtering. Use fetchmail to fetch from POP and deliver to your local users’ mailboxes, which is collected by the IMAP server and filtered with sieve. Then you don’t rely on kmail’s filters when using mutt.

  2. hmm,
    I’m not sure if I get your point right – why don’t you just keep your current mail-chain (fetchmail+maildrop sorting directly into imap folders) and then set an expiery limit in kmail on the relevant folders ?

  3. Almost the same reason why I still use thunderbird. KMail is a good app., but it really behaves oddly when it comes to IMAP.

  4. Try to set the imap-account as ‘disconnect imap’ or use a manual filter. And of course, you can use an external script to copy the filtered mails to an imap-target.

  5. Hi,

    why not using server side sorting and filtering. If you use kolab or cyrus you can use sieve scripts like:

    if header :contains [“X-GMX-Antispam”] [“1″,”2″,”3″,”4”]{
    fileinto “INBOX/Spam”;
    stop;
    }
    if header :contains [“X-Spam-Flag”] [“Yes”]{
    fileinto “INBOX/Spam”;
    stop;
    }
    if header :contains [“X-Spam-Level”] [“****”]{
    fileinto “INBOX/Spam”;
    stop;
    }

    You can also use sieve for a holiday auto replier and so on. You can edit and upload your sieve script from kmail. Of course its also possible to use client filtering like “only store mails for XX days”

    Bye

    Thorsten

  6. Thanks for all the suggestion.

    Installing a different mailserver just for server-side-filtering is not an option, I hardly manage my exim setup🙂

    Neither is using Thunderbird, that one doesn’t even have decent mailinglist support.

    So my conclusion is: Let fetchmail+maildrop do the fetching/filtering as it was until now and let KMail do the deletion after 90 days.

  7. I have a similar setup (getmail + maildrop). To delete mail after X days I use archivemail ( http://archivemail.sourceforge.net/ ). It’s easy to use: deleting messages older than 90 days from .some.dir is done like this:

    archivemail –days=90 –delete .some.dir

  8. Instead of using fetchmail and maildrop you could use http://fdm.sourceforge.net/. A tool for fetching, filtering and archiving emails. It is definitely worth a look and it should do exactly what you need.

    I just looked at the documentation.
    This could be intersting for you:

    7.8 Matching by age or size
    Mail may be matched based on its age or size.
    […]
    The age is extracted from the ‘Date’ header, if possible.
    […]

    9 Archiving and searching mail
    […]

    Regards, Daniel.


Sorry, the comment form is closed at this time.

Blog at WordPress.com.
Entries and comments feeds.

%d bloggers like this: