Recovering deleted emails on IMAP server with Thunderbird

imapthunderbird

I have an IMAP mail server and use Thunderbird as my client. I didn't understand the sychronization of client-server using IMAP vs POP. My IMAP server was filling up, so I logged onto the server and deleted the Inbox thinking that Thunderbird had local copies of the mail.

When I opened Thunderbird, it synched against the IMAP server and marked all my email as deleted. The emails still exist in the {path}/thunderbird/profile/default/INBOX file fortunately. After some research on the net, I edited that file and changed all the “X-Mozilla-Status:0001" to "“X-Mozilla-Status:0000".

When I brought Thunderbird back up, the emails were still gone. Does anyone know how to recover these?

Best Answer

I had a similar problem - through some quirk a bunch of emails disappeared from my IMAP server, but remained in the INBOX and Sent files on the local drive. I was unable to coerce Thunderbird to restore those emails onto the IMAP server directly, so I went with another approach:

  • Create a POP3 account with the same credentials as the IMAP one, but make sure this account is unable to connect - don't enter your password.
  • Shut down Thunderbird, and navigate to /Profile/randomname.default/Mail/hostname_of_your_server/
  • Double-check that this is indeed your freshly created dummy account and not some other valuable, but similarly named POP3 account.
  • Copy over the Inbox file containing the deleted emails, overwriting the one from the dummy account, and delete the inbox.msf file that was also in that dummy account folder.
  • Start Thunderbird - notice you have all your emails back! Both the deleted and the undeleted ones are visible in the dummy POP3 account.
  • Now grap the Thunderbird "Remove duplicates (Alternate)" extension from here: Remove duplicates (Alternate).
  • Using the above extension, set the IMAP Inbox as the "Set original message folder(s) for next duplicate search", and run the "Remove duplicates" on the dummy POP3 Inbox.
  • Move the duplicate messages to Trash.
  • Move the remaining messages from the POP3 Inbox, to the IMAP Inbox. Thunderbird will re-upload all the messages automatically to the IMAP server.

Done!

Related Topic