This chapter was converted from the KDE UserBase KMail/FAQs Hints and Tips page.
2012-01-28
&kde; SC 4.8

# &kmail; Troubleshooting

## KMail doesn't send mail

Some users find that mail does not go out, and it appears that &SMTP; is missing, even though the Settings page looks correct. It has been reported that this is cured by opening akonadiconsole and adding Mail Dispatcher Agent.

If the computer was suddenly turned off in suspend mode (&eg; by a power cut) sometimes e-mails simply stay in the outbox without being sent, but no error message is generated either. This may be due to the fact that the Mail Dispatcher Agent is set to offline in the configuration file during suspend and is not changed back due to the crash. Edit the following file:

`~/.config/akonadi/agent_config_akonadi_maildispatcher_agent`

and change

    [Agent]
    Online=false

to

    [Agent]
    Online=true

## Clean start after a failed migration

In case migration from &kmail; 1 to &kmail; 2 fails or you have weird problems after it, you can try to do a clean import of your data, instead of migrating the existing settings. Be warned, that needs more manual setup, so do only if you are confident with setting up again your &kmail; accounts, and it can generate a large amount of network traffic for &imap; resources.

1. Stop Akonadi and related applications

   quit &kmail;/&kontact;/&korganizer;, and issue this command:

   ``akonadictl stop``

   Make sure no Akonadi or MySQL process is running:

   ``ps ux | grep mysql``

   ``ps ux | grep akonadi``

   They should not show anything else but the grep process itself.

2. Remove old Akonadi database and config

   Delete the following folders

   - `~/.local/share/akonadi`

   - `~/.config/akonadi`

   Delete also the files starting with akonadi from `~/.kde4/share/config`

3. Restart Akonadi server

   ``akonadictl start``

4. Add back the accounts

   Now it is time to add back your account. You can use &kmail; (&kontact;) for it, or you can use the akonadiconsole tool.

   In &kmail;: Settings Configure KMail Accounts and use Add.

   If you use &imap;, add a new &imap; E-Mail server. If you want disconnected mode (so you can read the mails offline), enable it on the Advanced tab. Be sure to check that you are subsribed to all your important folders.

   You might already see a Local folder resource. This points to a local maildir folder. You can either modify this to point to your existing maildir folders or you can add a new resource for local mails.

   When adding a maildir resource you can choose between &kmail; Mail Folder or Maildir. Unless you have a mixed folder containing both maildir folders and mbox files, you should choose Maildir. For independent mbox files, like the one in the `/var/spool/mail`, you can set up a new MBox folder.

   Add the POP3 accounts as well. In case you have multiple Local Folders set up, choose on the Advanced tab the destination folder where the newly downloaded mails are put.

   For all accounts, configure the mail check interval. For Local folders disable interval checking and also disable Include in manual mail check in the Retrieval options.

   Add the sending (SMTP) accounts.

5. Fix your filters, identities and favourite folders

   If you have client side filtering (common with POP3 mails), go to Settings Configure Filters and fix the destination folder for the filters, they most probably are wrong. Otherwise mails will end up in folders you don't expect.

   Spam filter (at least in version 4.7.3 and earlier) does not work as expected in that the rule that the wizard creates does not send spam to the folder you have defined.

   The workaround for this is to change the spam and spam unsure (if the spam filter you use support that) from looking at Status-fields in the header `X-Spam-Status` to look Anywhere in headers for X-your spam filter-Classification: SPAM or unsure. Look at the filters the wizard creates and copy the contains part. Example for Spambayes: X-Spambayes-Classification: spam and X-Spambayes-Classification: unsure.

   You also need to verify the identity settings and set the sent-mail, drafts and templates folders to point to the right folders. To do that go to Settings Configure KMail Identities, modify the identity, go to the Advanced tab and modify the above mentioned folder settings.

   Check also that your Favourite Folders are the ones you have chosen before.

6. Initiate a mail check

   Start a mail check for your accounts. It is suggested doing it per account.

   First do for &imap;, if you have.

   Next is to check (import) your local mails. One solution is to do a full check in one go File Check Mail In and select the local account, the other is to click one by one on the folders, that should initiate the check for that folder (alternatively right click on the folder name and select Update Folder).

   The initial import might be slow and could use a lot of memory, especially in case you have folders with a large amount of mail. In that case per-folder check is preferred. In case the check (complete or for one folder) is finished and the memory usage is still high, you could restart the Akonadi server — as seen above — or just the maildir agent, if you use `akonadiconsole`. Do not worry, this high memory usage is only for initial import.

   Initiate a check mail for POP3 resources.

Hopefully after these steps, you will have a much nicer &kmail; experience.