Recover deleted or corrupted Thunderbird messages - gHacks Tech News

Recover deleted or corrupted Thunderbird messages

It sometimes happens that I delete a mail by accident because it does look like spam or like a message that I do not longer need access to. Thunderbird does not display that message anymore if it is completely deleted from the mail client. While it is first moved to the trash folder if you delete it from the inbox, deleting it from the trash or the spam folder removes it permanently from the client.

Unknown to many is that Thunderbird does not delete messages right away when that is happening, but flags them only which means it is relatively easy to recover corrupted or deleted mails as long as the mail folder has not been compressed in the meantime.

So, even if you delete the trash or remove spam, the messages are still stored in the index files that Thunderbird uses.

Compressing removes flagged emails, those that you have deleted, from the mailbox so that you can't recover them anymore once that has happened.

Recover deleted emails in Thunderbird

Open the Thunderbird Application Data folder which is located in your document and settings folder in Windows.

The easiest way to get there is to click on Help > Troubleshooting Information and click on the show folder button on the new page that opens up.

Select the appropriate Thunderbird profile if there is more than one and click on Mail in that profile. You get a listing of all your email addresses. If you setup Thunderbird to have different mail folders for every email address you have to click on the folder of the email address of the message that you want to recover. Otherwise Local Folders is the way to go.

The important files are those without extensions (Trash, Sent, Inbox ..) - locate the one that contained the mail(s) that you have deleted or are corrupted (do not show up anymore). Open it in an text editor, you could use notepad2 for instance for this purpose. Some folders may be rather big so choose a text editor that can handle large files.

Thunderbird needs to be closed completely while you are editing the files.

thunderbird folder

All mails are basically stored in that file. The important part for us are the lines X-Mozilla-Status which defines a certain state of a message such as Read, Unread or Deleted. Search for the message(s) that you want to recover, the easiest way to do so is to search for its subject or the sender's email address, and edit the X-Mozilla-Status: XXXX line into X-Mozilla-Status: 0000 for unread or X-Mozilla-Status: 0001 for read messages.

Recovered messages will appear at the bottom of the folder and should be there after you start up Thunderbird the next time. You sometimes have to delete the .msf file to make this work. If you edit the file Trash you will have to delete the file Trash.msf afterwards if the mails do not re-appear after a new start of Thunderbird.

Update: Please note that you find the Mail folder under C:\Users\username\AppData\Roaming\Thunderbird\Profiles\random.default\Mail\ in newer versions of the Windows operating system.

We need your help

Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.

We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.

If you like our content, and would like to help, please consider making a contribution:

Comments

  1. Steve Weller said on January 25, 2007 at 2:37 pm
    Reply

    Worked a treat for me. Actually, it worked even better than I’d hoped: migrating email from Thunderbird to GroupWise, I managed to lose about 18 months worth of email from one of my most critical folders. Or so I thought. Your suggestion allowed me to recover all my previously “lost” email by simply editing a single X-Mozilla-Status line. Not sure why this worked, and I don’t particularly care, ’cause I got my email back. Three cheers.

    1. david lui said on March 12, 2010 at 2:01 am
      Reply

      today i dont’ know inbox the email all move to trash. please back to inbox .

  2. doug said on May 6, 2007 at 8:38 pm
    Reply

    thank you so much for this article. I deleted when I shouldn’t have and now I have recovered them. Thank you, thank you, thank you….

  3. b said on June 27, 2007 at 7:07 am
    Reply

    Thank you! this worked really well. I have a 100+MB mail file .. all mail was deleted. There were heaps of different mail status flags being used and 851 emails so I wasn’t going to do it by hand. So I opened it in Textpad (from textpad.com) pressed F8 and used the following find query: “X-Mozilla-Status: [a-z0-9]\{4\}” (no quotes).. replaced with “X-Mozilla-Status: 0001”, clicked replace all and it is done! :)

    1. rajagopalan said on April 23, 2014 at 12:45 pm
      Reply

      Is find next expression u mentioned is right. I am getting an errot

  4. Katie said on November 8, 2007 at 10:14 pm
    Reply

    THANYOU THANKYOU THANKYOU – set text editor to replace all x-delivery-status: 0008 with x-delivery-status: 0000 and it worked!!!!

  5. Foreigner said on December 19, 2007 at 8:26 am
    Reply

    The technique works only if you have not done a “Compact” operation on the mail folder.

  6. Brian said on December 29, 2007 at 6:04 am
    Reply

    My PC crashed but I had a back-up of the email folder but not my profile. I rebuilt the PC and restored my email folders. Everytime I went into one of my keepers folders, it deleted my emails. Since I didn’t backup my profile, I had to reset the ‘recover disk space’ to not delete emails (every folder and the server in the accounts setup), modify every X-Mozilla-Status to 0001. You can only do this if you still have your .msf file

  7. Shashikant Gaikwad said on January 11, 2008 at 4:20 pm
    Reply

    Thanks for knowing me about removing deleted mark into the mbox file of thunderbird. It helped me a lot.

  8. melanie said on December 16, 2008 at 7:54 pm
    Reply

    It never worked for me and have been losing mails mysteriously. I have infact lost more than 6ooo mails

  9. Nicolas said on May 9, 2009 at 3:38 pm
    Reply

    Thank you so much!

  10. Max said on June 18, 2009 at 4:34 pm
    Reply

    This has been a veryyyy useful post. It really works. I had about 1200 emails in my inbox and samn they were not opening. Even though the folder used to show up in thunderbird, but when I used to click on the inbox folder I was not able to see my previous emails !!!! I tried everything nothing work. Thanx a million for above posts. Just downloaded textpad, opened the inbox file (it does not have any extension, so choose open all files option in textpad). It took a while for textpad to open since mine was 800MB file. Pressed F8 search for X-Mozilla-Status: 0001 and replaced with X-Mozilla-Status: 0000

  11. website design New York City said on June 25, 2009 at 12:29 pm
    Reply

    thank you! That looks like a great resource

  12. Sean said on August 10, 2009 at 11:22 am
    Reply

    Excellent tip nearly paid $20 for a program that does what you describe
    Thanks

  13. PaulR said on October 15, 2009 at 7:10 pm
    Reply

    Thanks, top tip! Thought I’d lost everything and now I’m getting it back as I edit each file. Top banana..

  14. Anonymous said on February 3, 2010 at 12:04 pm
    Reply

    you are an absolute sweetheart!!!! It worked.

  15. JJames said on May 31, 2010 at 10:43 pm
    Reply

    Thank you so, so, so, so, so much. You just saved me 2 hours or more of writing an e-mail :)

  16. X said on June 26, 2010 at 4:46 am
    Reply
  17. Cristian Fasie said on April 7, 2011 at 2:32 pm
    Reply

    THANK YOUUUUUUUU !!!!!!

  18. Thiru said on October 13, 2011 at 9:33 am
    Reply

    Superb One.. Not many issues solved like this… Very Useful…….

  19. Thiru said on October 13, 2011 at 9:36 am
    Reply

    Thank you………..so much…….. you have saved nearly 4000 mails, and saved me from many problems..

    1. Martin Brinkmann said on October 13, 2011 at 10:54 am
      Reply

      Glad you were able to recover your emails.

  20. Bruno Santos said on January 17, 2012 at 1:45 pm
    Reply

    Well done! It’s a life saver. I was able to recover 900+ emails that thunderbird had disappeared with ! Thank you so much !

  21. Lee said on May 28, 2012 at 7:19 pm
    Reply

    I just lost two folders entirely by losing the actual files, I did some research, here is the result. The global-messages-db.sqlite exists in all profiles and is a database with the text of all emails optimised for searching. The actual email data including attachments are usually in the “Mail” folders. I lost two folders and managed to recreate all emails by fetching them out of the global-messages-db.sqlite with this command:

    sqlite3 -line ~/.thunderbird/xf5qyjk5.default/global-messages-db.sqlite “select date,id from messages where folderID = 52”

    You need to check what your folder number is and there you go.

    You then just have to do some reformatting (check other email files) and then put the file into your “Mail” folder.

  22. Sarah said on September 18, 2012 at 11:15 am
    Reply

    Thank you, thank you, thank you – I lost a huge email yesterday (when I pressed send it disappeared) and this has saved me about two days work rewording it. (I’ve now saved the body as a text file lest the same thing should recur!)

  23. Bruce Banner said on May 31, 2018 at 9:53 am
    Reply

    Hi
    Your Method is very useful and easy to use. I recovered my lots of emails by this method. But recently I started using Outlook and I transferred my all Thunderbird data to Outlook. During this process, I lost some of my important emails. I’m looking for a method to recover them too.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

Please note that your comment may not appear immediately after you post it.