Monday, December 22, 2008

ThunderBird A few Tips & Tricks

    Thunderbird, is an alternative open source e-mail client. I would recommend it to everyone. if you are using Thunderbird as your E-mail client then this article might be useful to you. So let's get started.

    You might encounter this problem at some point in time.  I use many sub folders and while clicking on them, the program stays frozen for a few seconds and then showed it's content. The same thing happens while trying to deleting a  mail. This was really annoying.
    Three ways of trying to sort out this problem are
    A Use Thunderbird's 'Compact Folders' option frequently. All messages in a given folder are stored in one continuous database file. When you delete or move a message, it is not actually removed from this file, but left in place and marked as inactive so the program knows not to display it. This is done to keep from slowing your system down by having to rebuild the whole database every time you move or delete a message. The operation to remove all inactive messages at once is called "Compacting". It rebuilds the database file, and updates the .msf summary file for that database. This can cure many message base ills and it should be done regularly.It's possible that many users have never heard of compacting folders (not to be confused with compressing a file). However, most e-mail clients do this to improve performance by not requiring the e-mail client to rewrite the entire folder every time you delete a single message. The reason you might never have heard of compacting is that most e-mail clients default to automatically compacting the folder whenever a certain amount of space is wasted, while you have to enable this in Thunderbird.

How to compact folders

    The best way is to let Thunderbird do this automatically: "Tools -> Options -> Advanced -> Network & Disk Space -> Disk Space -> Compact folder when it will save over 100 kB -> OK."

    To compact all folders in an account manually, click the account on the left, and then click "File -> Compact Folders". Compacting an account may take from a few seconds to 10 minutes or more, depending on how much mail you have and how recently you last compacted the folders. If you have trouble doing this and the process stalls, try compacting one folder at a time by right-clicking on the folder and choosing "Compact This Folder". If you do not let Thunderbird compact automatically, you should do this regularly.

    Most people never have a problem compacting a folder when its online. However, if you get Nstmp folders that's due to the compacting being interrupted while Thunderbird is downloading new messages. You can avoid this by going offline before compacting (go to "File -> Offline -> Work Offline", or simply click on the icon in the bottom left corner.) It is rare for this to cause other problems but if you suspect it, experiment with going offline before compacting (ideally on a new known good folder). You can only compact IMAP accounts while you are online. However, this normally doesn't cause a problem since IMAP accounts only download the headers to the hard disk.

The 'Xpunge' extension lets you add a button to empty the trash and compact the folders in multiple accounts (in one step). If you use the beta version you can set a timer to automate that. The Mozilla Add-ons web site has several other extensions that add buttons to compact folders.

If you have an IMAP account there are two ways to automate compacting its folders.

    * If you check Tools -> Account Settings -> Server Settings -> Clean up ("Expunge") Inbox on Exit it will compact the Inbox folder when you exit Thunderbird. If you check "Empty Trash on Exit" it will also empty and compact the Trash folder when you exit.

    * If Tools -> Account Settings -> Server Settings -> "When I delete a message" is set to "Move it to the Trash folder" and you set mail.imap.expunge_after_delete to true using the Config editor Thunderbird will compact the folder immediately after you delete or move a message. Note: Thunderbird ignores the modified mail.imap.expunge_after_delete setting until after you have exited and restarted Thunderbird.

    B Another method is right click on a folder which is sluggish go to 'Properties' & click on 'Rebuild Index' under the 'General Information' tab

If compacting doesn’t seem to work
    C When I checked my profile and found many files and folders. I also searched the Thunderbird website for more information. What really got attention to my eyes was this article.
    The apparently problem lies in *.msf files, which are summary files for each folder and might become corrupted and can contain "garbage". So I tested this right away (read results bellow). I have mentioned below the procedure but use this at your own risk. Backup your profile before proceeding.
   1. Close Thunderbird.
   2. Click START - RUN and type %APPDATA%\Thunderbird
   3. Then find profiles.ini file and open it in notepad.
   4. Find the line which contains Path= parameter. Under this parameter is a path to your profile.
   5. Go to your profile folder, where you will find *.msf files.
   6. Delete *.msf files and restart Thunderbird.
   7. Wait for a few minutes, while Thunderbird generates all *.msf files back. When summary file for X folder is done, you can click on X folder and see it's content. If you don't see anything, while clicking on X folder, than summary file is not ready yet or you might have another problem.
   8. Restart Thunderbird.

When I reopened Thunderbird I was happy :to find folders opened instantly with no delays. I also noticed that some of *.msf files are smaller now, so this proofs that some parts were unnecessary in those files. OR


If the corruption is severe deleting the .msf files won't help much, and compacting the folder may just make it worse. You'll typically run into this only with the 'Inbox' folder. Its much more vulnerable to corruption because many users tend to store lots of messages in it and they also frequently delete messages in it. Thats why its recommended that you don't permanently store messages in your Inbox folder, move them to other folders. You can fix the problem by replacing the corrupt folder with a new known good folder that you copied the messages to.

   1. Exit Thunderbird and make a temporary backup copy of your profile folder so that you can revert everything easily if necessary.
   2. Start Thunderbird, create a new folder and name it 'Test' folder'.
   3. In the folder that is giving you problems (e.g. Inbox), select all the messages (highlight one and then press Ctrl+a) and copy them to
'Test' folder ("Message -> Copy" -> [account name] -> 'Test' folder). In extreme cases (if Thunderbird and/or the computer become extremely sluggish), you may have to choose only a few emails at a time (choose one and then press Shift+Page Down or Page Up once or twice).
   4. Verify that all of the messages have been copied to
'Test' folder.
   5. Right-click on
'Test' folder and choose "Compact This Folder".
   6. Go to your profile folder and see if
'Test' folder looks like it has been compacted. It should be significantly smaller in size than the folder from which you copied the messages.
   7. If it looks like
'Test' folder can in fact be compacted successfully, exit Thunderbird, and go to your profile folder. Then:
  • Rename the file that was giving you problems (e.g. rename "Inbox" to "InboxOLD") and delete its .msf file (e.g. "Inbox.msf").
  • Rename the 'Test' folder to "Inbox" (or whatever the problematic folder was called) and delete "'Test' folder.msf".
  • Restart Thunderbird, and use it as usual. If compacting folders seems to work correctly during a test period (such as one week) then you can delete the folder "InboxOLD".

    If you a lazy fellow like me & don't bother to compact folders, then be warned that you could face any of the following problems. Mail files will accumulate more and more of the "hidden" messages that have been marked for permanent deletion but have not yet been removed. This can cause a lot of disk space to be used, and it can have a negative effect on Thunderbird’s performance.

  •     Even if a mail folder seems to be empty or nearly empty, the mail file can become very large. This wastes disk space, and when you back up your mail files for safekeeping, you will waste time backing up all these "hidden" messages as well.
  •     When downloading messages, you might occasionally get duplicates of messages you’ve already received
  •     Messages that you have deleted or moved to other folders may unexpectedly reappear in their original folder.
  •     Your anti-virus software might detect infected messages that you long ago deleted, even if you emptied the Trash.
  •     It could cause problems when you try to defragment your hard disk.
  •     Your Inbox might stay blank for minutes.
  •     The new message count could become much larger than the actual number of new messages. A quick fix is to delete the .msf mail summary file for that folder—Thunderbird will create a new one the next time you run it—but this will not work if the folder is badly corrupted.
Inbox stays blank

Another problem that a user can encounter is 'Blank Inbox'.  When you try try to open the Inbox and nothing happens (the message list stays blank). The "Building summary file" message (in Thunderbird's status bar) lasts for minutes. Sometimes the contents of the Inbox appear and sometimes they don't. Thunderbird hasn't entirely frozen; it still responds but the Inbox doesn't display messages or behaves strangely.

Try C2 above

If the problem is still not solved then try (not done this personally).

  a.  Exit Thunderbird.
  b. Delete the files "InboxOld" and "InboxOld.msf" and the folder "InboxOld.sbd" from your profile folder.
  c. Download the ImportExportTool extension. Note: The ImportExportTool extension used to be called the mboximport extension.
  d. Start Thunderbird and install the ImportExportTool extension.
  e. After restarting Thunderbird, try to import one of the copies using the ImportExportTool extension.
  f. If this succeeds, you can move the messages to where you want them (I suggest somewhere else than the Inbox).
  g. If you get a message that the file is not in a valid mbox format, you can try opening the file using any text editor (note that for big Inbox files - I was working with one problematic one that was more than 200MB - it will take a long time to open the file)
  h. Check that the opened text file is of a proper mbox format. In the case of my problematic file, the corruption occurs in the first line of the file. Correcting the line results in successful importing using the ImportExportTool extension.
  i. If this also fails, you may have to take your loss.

1 comment:

Anonymous said...

Good one :D Thanx