Thunderbird:Undelete All Messages

From MozillaWiki
Revision as of 23:27, 24 January 2008 by Completeja (talk | contribs) (Undelete All Messages)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

If you or an antivirus program has recently edited the Thunderbird POP mbox mail database file and many messages are missing or many duplicate messages have appeared, consider restoring all the messages you have deleted since compacting. For restoring only one message, see the Mozillazine Knowledge Base entry. For IMAP accounts or POP accounts where the messages are still stored on the server, again see the Mozillazine Knowledge Base entry. To find the location of the database file, once again see the Mozillazine Knowledge Base entry. Note that deleting a message in Thunderbird hides the message and marks it for deletion, and compacting a folder removes the messages that are marked for deletion from the mail database file, so messages that have not been deleted from the mail database file can be restored. First consider closing Thunderbird and deleting the file with the msf extension, as it is simply an index file and will be regenerated correctly if you delete it. If you restart Thunderbird and the problem has not been fixed, close Thunderbird and open an editor that allows for regular expression find and replace. If you do not use VI or VIM or the like you will need to alter the instructions for your editor. Back up your mail database file and then open it in VI, and type the following:

:%s/^X-Mozilla-Status: \([0-9A-Fa-f][0-9A-Fa-f][0-9A-F]\)9/X-Mozilla-Status: \11/
:%s/^X-Mozilla-Status: \([0-9A-Fa-f][0-9A-Fa-f][0-9A-F]\)[Aa]/X-Mozilla-Status: \12/
:%s/^X-Mozilla-Status: \([0-9A-Fa-f][0-9A-Fa-f][0-9A-F]\)[Bb]/X-Mozilla-Status: \13/
:%s/^X-Mozilla-Status: \([0-9A-Fa-f][0-9A-Fa-f][0-9A-F]\)[Cc]/X-Mozilla-Status: \14/
:%s/^X-Mozilla-Status: \([0-9A-Fa-f][0-9A-Fa-f][0-9A-F]\)[Dd]/X-Mozilla-Status: \15/
:%s/^X-Mozilla-Status: \([0-9A-Fa-f][0-9A-Fa-f][0-9A-F]\)[Ee]/X-Mozilla-Status: \16/
:%s/^X-Mozilla-Status: \([0-9A-Fa-f][0-9A-Fa-f][0-9A-F]\)[Ff]/X-Mozilla-Status: \17/

These commands set the delete bit the X-Mozilla-Status headers of each message to zero. For a list of all the bits in the X-Mozilla-Status header, see this page.