Answers to: How to recover saved (stored) emails after damage to KMail configuration?http://linuxexchange.org/questions/2660/how-to-recover-saved-stored-emails-after-damage-to-kmail-configuration<p>Recently my computer had to be hard-reset, and fsck ran on <code>/home</code> filesystem, producing lots of errors (old HDD drive).</p> <p>After reset I don't see all my saved emails in KMail (KDE 3.5.3), at least those that were present in folder that was opened when computer crashed. The files are there physically in <code>~/Mail/folder/cur</code>, but they are not visible in KMail component of Kontact.</p> <p>The configuration files got damaged -- beside not seeing all saved emails, I have lost configuration of all my email accounts.</p> <p>Is it possible to fix KMail configuration to make those saved emails visible again?</p>enTue, 22 Nov 2011 08:45:33 -0500Answer by unSpawnhttp://linuxexchange.org/questions/2660/how-to-recover-saved-stored-emails-after-damage-to-kmail-configuration/2749<p>If you look at the <a href="http://userbase.kde.org/KMail/">KDE KMail</a> page you see it stores email in mailbox format by default. At the bottom of that page, see "Other Tools and Patches", there's a configuration file excerpt that shows you how to mount a mailbox. So if for example you have a Gmail account with a mailbox called "Gmail.mbx" then its configuration part could read:</p> <pre><code>[Gmail] Folder=~/Mail/folder/cur/Gmail.mbx Name=Gmail Type=local </code></pre> <p>Putting one and one together: 'chmod 0440' your existing mailboxes in ~/Mail/folder/cur/ to ensure they don't get changed by reconfiguration, in KMail configure your accounts and mailboxes, close KMail to save configuration and then check if its account and mailbox configuration matches what you have in ~/Mail/folder/cur/ (adjust configuration with a text editor). Run KMail and see if it opens the files. </p> <p>* If it doesn't it could be the mailboxes were damaged. Check by running 'file ~/Mail/folder/cur/*' on the files. Magic should return something along the lines of "ASCII text" (not "data") and the files should be human readable using any command line or GUI editor or text viewer. If they aren't you've just found out why making backups is important.</p>unSpawnTue, 22 Nov 2011 08:45:33 -0500http://linuxexchange.org/questions/2660/how-to-recover-saved-stored-emails-after-damage-to-kmail-configuration/2749