Undelete a message: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
(added a non-issues category)
(added thunderbird reset program)
Line 5: Line 5:
==POP account (mbox files)==
==POP account (mbox files)==


There are three different approaches. Which one is most appropiate depends upon how many messages you need to recover and how technical you are.  
There are four different approaches. Which one is most appropiate depends upon how many messages you need to recover and how technical you are.  


All of the messages for a folder are stored in a text file called a mbox file which has the folders name and no file extension. Its stored in the [[Profile | profile]]. If you're using Windows Explorer you may need to configure Tools -> Folder Options -> View to show hidden/system files in order to see the profile directory. The first thing you need to do is to find the mbox file. For example, if you want to undelete a message in your gmail accounts inbox under XP and your Windows user account name is JohnSmith:
All of the messages for a folder are stored in a text file called a mbox file which has the folders name and no file extension. Its stored in the [[Profile | profile]]. If you're using Windows Explorer you may need to configure Tools -> Folder Options -> View to show hidden/system files in order to see the profile directory. The first thing you need to do is to find the mbox file. For example, if you want to undelete a message in your gmail accounts inbox under XP and your Windows user account name is JohnSmith:
Line 42: Line 42:


Your .EML file still contains a header saying its been deleted so you don't want to import it as a message in Thunderbird. You could drag and drop the message into a folder window within Outlook Express (while its running). That will import it as a message in that folder. Then you could forward the message to yourself. That adds a new set of headers so Thunderbird will ignore the old X-Mozilla-Status header (which says its deleted). You could also copy and paste the message body into a new message in Thunderbird or send it as an attachment.
Your .EML file still contains a header saying its been deleted so you don't want to import it as a message in Thunderbird. You could drag and drop the message into a folder window within Outlook Express (while its running). That will import it as a message in that folder. Then you could forward the message to yourself. That adds a new set of headers so Thunderbird will ignore the old X-Mozilla-Status header (which says its deleted). You could also copy and paste the message body into a new message in Thunderbird or send it as an attachment.
===Use Thunderbird Reset Status program plus mboximport (Windows only)===
Save a copy of the mbox file in a empty directory. Then run Thunderbird Reset Status from [http://apveening.speedlinq.nl/software/ this web site] on the mbox file to reset the messages status. Import the .mbx file using the [http://nic-nac-project.de/~kaosmos/mboximport-en.html mboximport extension]. This should create a a copy of the folder with all of the messages undeleted.
Note: The programs author warns that the program still needs more testing.


==IMAP account==
==IMAP account==

Revision as of 04:13, 16 October 2006

This article was written for Thunderbird but also applies to Mozilla Suite / SeaMonkey (though some menu sequences may differ).

Deleted messages aren't physically deleted until the folder is compacted. They are merely hidden from view and the X-Mozilla-Status: message header modified to indicate the message has been deleted. The deleted message is also typically copied to the Trash folder. If you accidentally delete a message you can recover it from the Trash folder if it hasn't been emptied. Otherwise Thunderbird (normally) doesn't provide a way to undelete the message. However, its still possible to undelete a message as long as you haven't compacted the folder.

POP account (mbox files)

There are four different approaches. Which one is most appropiate depends upon how many messages you need to recover and how technical you are.

All of the messages for a folder are stored in a text file called a mbox file which has the folders name and no file extension. Its stored in the profile. If you're using Windows Explorer you may need to configure Tools -> Folder Options -> View to show hidden/system files in order to see the profile directory. The first thing you need to do is to find the mbox file. For example, if you want to undelete a message in your gmail accounts inbox under XP and your Windows user account name is JohnSmith:

1. Goto the profile directory. It will typically be at C:\Documents and Settings\JohnSmith\Application Data\Thunderbird\Profiles\xxxxxxx.default user where xxxxxxx is some random sequence of letters and numbers
2. Goto the Mail subdirectory.
3. Goto the pop.gmail.com subdirectory. All of the messages for an account are stored in a subdirectory named after the mail server. If you were using a global inbox you'd goto the Local Folders directory instead.
4. Find the "inbox." file.
5. Then choose one of the following three methods. Editing the X-Mozilla-Status: header is the best solution if you're comfortable editing the mbox file since it truly undeletes the message.

Copy and paste the text from the mbox file

Save a copy of the mbox file and then open it with a text editor. The messages are stored "as is" one after another, each seperated by a blank line and a From_ line. A From_ line starts with "From " and has the time and date. For example: From - Wed Oct 27 11:08:59 2004 . If you see any big blocks of characters all run together thats probably the base64 encoded data for an attachment. Thats how it embeds 8-bit data such as a .JPEG file in a 7-bit message.

Browse the text file until you see the message you want to recover. Copy and paste the message body to a new message in Thunderbird.

Edit the X-Mozilla-Status: header in the mbox file

Save a copy of the mbox file and then open it with a text editor. The messages are stored "as is" one after another, each seperated by a blank line and a From_ line. A From_ line starts with "From " and has the time and date. For example: From - Wed Oct 27 11:08:59 2004 . If you see any big blocks of characters all run together thats probably the base64 encoded data for an attachment. Thats how it embeds 8-bit data such as a .JPEG file in a 7-bit message.

Browse the text file until you see the message you want to recover. Find the X-Mozilla-Status: header. It should look something like X-Mozilla-Status: 1001 . The number will vary. Edit that value to zero and save the file. The next time you run Thunderbird it should think the message is a new unread message.

If this doesn't work look for a line beginning with >From in the message body. Remove the '>'. Thunderbird uses "From quoting" to help it distinguish between the From_ line used to seperate messages and some line in the message body that starts with From. Sometimes that causes problems.

Convert the mbox file to .EML files

You can use a utility program to convert the messages in the folder into .EML files. This will not effect the mbox file (your Thunderbird folder). The utility program doesn't understand the X-Mozilla-Status header so it doesn't know the message is deleted.

If you're using Windows download and install IMAPSize. Don't be mislead by the name, you don't need a IMAP account to use it. Select Tools -> mbox2eml. Select the mbox file in "choose one mbox file to convert" and where you want to store the .EML files in "chose folder where eml files for this mbox will be saved". You may need to need to choose "All files" in "Files of type:" since Thunderbirds mbox files don't end in .mbox. Then press the Convert button.

Otherwise you could use the Java based mbox2eml program.

Your .EML file still contains a header saying its been deleted so you don't want to import it as a message in Thunderbird. You could drag and drop the message into a folder window within Outlook Express (while its running). That will import it as a message in that folder. Then you could forward the message to yourself. That adds a new set of headers so Thunderbird will ignore the old X-Mozilla-Status header (which says its deleted). You could also copy and paste the message body into a new message in Thunderbird or send it as an attachment.

Use Thunderbird Reset Status program plus mboximport (Windows only)

Save a copy of the mbox file in a empty directory. Then run Thunderbird Reset Status from this web site on the mbox file to reset the messages status. Import the .mbx file using the mboximport extension. This should create a a copy of the folder with all of the messages undeleted.

Note: The programs author warns that the program still needs more testing.

IMAP account

IMAP accounts support remote folders that you can access as if they're local folders, and normally only download the headers to the hard disk. Tools -> Account Settings -> Server Settings -> "when I delete a message" has a list box with three settings. If you had used "Mark it as deleted" the message is still visible and you can undelete it by just deleting it again. If you had used "Move it to the Trash folder" (the default value) or "Remove it immediately" you need to use a browser and login into webmail. Most webmail accounts will display messages marked for deletion by other email clients. They may draw a line through the listing in the folder or display a flag to indicate its deleted. The safest way to undelete it is to forward the message to yourself since that creates a new message.

See also

External links