Local Folders is added over and over

In some cases you might end up with a maildir account pointing to a certain place (like $HOME/Mail), but you still see a Local Folders folder in the folder list with Inbox/Outbox/Trash/Drafts/etc. subfolders and KMail keeps putting mails there, especially sent mails.

The problem is that certain folders are marked as special folders (system folders) and if you don't have them, KMail cannot operate correctly. That is the reason why it keeps re-creating that folder.

At this time there is no easy way to change this in the UI for all types of special folders. Here is what you can do:

  1. The Sent-Mail, Drafts and Templates folder is configurable for each identity. Go to SettingsConfigure KMailIdentities, select your identity, click on Modify, go to the Advanced tab and set the folders to point to the right place.

  2. The default Inbox is configurable for each POP3 account. Go to SettingsConfigure KMailAccount, select your POP3 account, click on Modify go to the Advanced tab and set the Destination folder.

  3. For IMAP accounts you can configure the Trash folder. Do as above. The setting name is Trash folder.

  4. The most problematic part is the Outbox. First, locate specialmailcollectionsrc in your KDE configuration directory ($HOME/.kde4/share/config or similar). It contains something like this:

[SpecialCollections] DefaultResourceId=akonadi_maildir_resource_0

Now start akonadiconsole, on the Agents tab locate your local account for your Outbox folder, click on it and note the identifier that appears in the lower part (akonadi_maildir_resource_XXX or similar). Put this identifier in the above shown specialmailcollectionsrc, by replacing the existing one.

After that restart akonadi (you can do from the akonadiconsole, ServerRestart Server or from command line with:

akonadictl restart

Now remove the Local Folders that you don't want to use anymore.

If it keeps reappearing and the Mail Dispatcher Agent still crashes, you need to do one more thing in akonadiconsole. Go to the Browser tab, find the outbox you want to use, right click on it, select Folder Properties, Attributes tab, enter SpecialCollectionAttribute then click Add, double click on the Value near the SpecialCollectionAttribute and enter outbox. Add also another attribute, the attribute name has to be ENTITYDISPLAY and the value ("outbox" "mail-folder-outbox" "" ()) (just copy paste from here). Restart akonadi and now you should be able to remove completely the unneeded local folder account.