Importing a mail archive

I have a large collection of old messages stored as a mail archive, created using “Archive Mailbox …” in Mail.app (Leopard). This is just a hierarchy of folders containg an mbox file and subfolders. I would like to import this archive into DT Pro Office. Considering that it’s just a bunch of mbox files, there shouldn’t be any problem in principle, but given that there are about 200 mail boxes, I’d love to automate the import to recreate the nested folder structure. This looks like a nice job for a script…

But before starting to write one myself, I wonder if anyone has already written such a script. There ought to be a “market”, because these mail archives are pretty much a dead end: Mail.app cannot open them, nor does any other program I know of.

Konrad.

Hi Konrad- First off, Mail.app should be able to open the .mbox files. AFAIK, Mail busily reconstructs a mailbox for them and processes them back into separate emails.

As for a script, someone from DEVON should chime in, but when I looked at this, I don’t think that email (either mbox or eml) import was scriptable via the DT dictionary. I believe you’d have to do something with UI scripting to automate it.

(Or on second thought, import all your mbox files back into Mail.app and use the Mail.app importer that is part of DT. That should enable you to batch the work.)

Good luck! Charles

Or on third thought, more simply, use Terminal. app to:

cat *.mbox > single-big-file.mbox

And then use the standard DT import dialog to process the one file.

The disadvantage to this approach is that they’ll all be in one big group. But that may not matter to you. Or perhaps there are subsets that could reduce your 200 files down to a smaller, manageable number.

HTH, Charles

You can use File > Import Mailboxes… in Mail to import ones created with Mailbox > Archive Mailbox….

Thanks for all those suggestions! Concatenating all the mbox files into one is not really an option, as I do need to preserve the classification. So I tried importing the mailboxes back into Mail.app and from there in to DT… with success, but not yielding a satisfying result.

The first step (importing into Mail.app) does not re-create the folder structure correctly. It creates the original folder hierarchy but with all folders empty. In addition, for each folder FOO it creates a folder FOO.mbox at the same level, which has no messages but a subfolder mbox containing what used to be in FOO.

Using the “import e-mail” function of DT, I then see a long list of folders all called mbox which I can import individually but not all in one operation. Moreover, all the messages end up in the same group mbox, so the classification is lost.

At the moment, I am contemplating writing a Python script that uploads all messages to an IMAP server, from which I could then try to import them correctly into DT. If anyone has a simpler idea, I’d be happy to try!

The only other idea I have is writing a script for Mail.app that cleans up the messed-up folder structure after the import. However, I have infinitely more experience with Python than with AppleScript, which is why I favour the Python+IMAP solution.

Konrad.