Author: Marcus Barczak Date: To: exim-users Subject: [exim] slightly OT - reconstructing mbox files?
Hey Guys,
Not directly an exim problem but hoping someone may have already had
the misfortune to have to do what i'm about to do. Due to a glitch,
I have a mail archiving system here that writes each sent and
received message to a file for selected domains (that's a received
and sent file for each user of the domain) - originally this was
using an appendfile transport but recently moved over to SMTP
delivery into a another machine (running a custom archiving smtp
server). Stupidly my archiving code neglected to insert the mbox
"\nFrom <sender> <date>" header that delineates the start of a
message in an mbox file, so I now have about 1gb of archived mail
that can't be read by anything as anything that supports mbox can't
find the start of each message :(
Now, I need to somehow fix this - so my question is, is there a
program out there that already exists that can reconstruct each
message into mbox format? (ie. work out and insert the "From <sender>
<date>" header between each message ? Google so far has turned up
nothing :(
I have started work on a perl script to read the file and try and
reconstruct the From seperators of messages by looking at the
Received: headers etc. However it's turning into a world of hurt now
dealing with MIME, parsing the seperators etc ..
I need to somehow fix this so if anyone has ANY advice i'd really
appreciate it. Is there an easier way to find where a message starts?