rebuild imap email from the cache - data recovery

Asked by Roger Morton

So I managed to delete all my email from my imap server (hit delete on the email in the Unmatched search folder).
And my isp would not restore it from backup.

So I have managed to recover the .evolution folder from a previous system backup. In this folder is
<email address hidden>@mail.aunix.com.au/folders/INBOX which contains 25Mb of data in 1400 files.

This data is I believe the local cache of the email that lived on my IMAP server in the good old days - pre disaster.

There is also /<email address hidden>@mail.aunix.com.au/folders.db of one meg

It is clear that evolution gives each email on the system a number - when you check mail it says - fetching message number 1234
And I can see how the program caches these messages in in the INBOX folder mentioned because there are numbered files
eg:

11676.HEADER
11676.1.MIME
11676.1.1.MIME
11676.1.1
11676.1.2.MIME
11676.1.2
11676.2.MIME
11676.2

And looking in these files I find all the data belonging to email messages.

Now evolution can import emails saved in berkley mail .mbox format. And so I did some reverse engineering to see what such a file format looks like. And using this info I have been able to concatenating the above files together. And by adding a few "------=_NextPart" lines here and there I successfully created a .mbox format file from the scraps left in the INBOX folder.
I could import this file and have my email message appear - complete with inline .gifs and attatchments.

But I did it by hand and I was not able to predict where I needed to put which "------=_NextPart" line where - I just had to use trial and error.

So the question is - is their an easy way to regenerate mail from the IMAP cache of emails evolution leaves on the client.

I tried copying the IMAP inbox to the pop folder ~/.<email address hidden>@mail.aunix.com.au and restart evolution in the hope that evolution would see all that data as pop email now. But it did not work. The mail was not seen by evolution in the pop mail box.

I wonder if the data in /<email address hidden>@mail.aunix.com.au/folders.db would help.
Does anyone know what format the data is in this file. My instal has this file type down as SQLite3 format. But this file did not open with SQLite3.

If there is not an easy way any one knows about does anyone know a good site explaining the intricacies of MIME email formats. Because if I understood that I could probably write something that would correctly recover the email data from the files that I have.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu evolution Edit question
Assignee:
No assignee Edit question
Solved by:
Roger Morton
Solved:
Last query:
Last reply:
Revision history for this message
Roger Morton (ttguy) said :
#1

So I solved this problem by learning how .mbox files and MIME format works - at least to some degree. And then writing some java code that gathers all the data and writes a .mbox file.

If anyone else ever needs to do something similar they can get my code and source here
http://www.aunix.net.au/ttguy/Evolution_Email_recovery.htm