Slashdot Mirror


Backing Up an IMAP Folder Tree?

Jason Weill asks: "After finishing up school, I'm transitioning away from my school-run IMAP e-mail account. During my time, I managed to save thousands of messages in dozens of subfolders in my 'Inbox' hierarchy. Pine lets me save an entire folder to a file easily. Mozilla creates a folder tree when I drag 'Inbox' into a local repository, but none of the messages in the subfolders are downloaded. Opera M2 assimilates all those messages into my collection, but it flattens them all into one giant mess. Are there any scripts or programs that can easily export an entire folder tree to files or import it into a local repository for an e-mail program?"

4 of 32 comments (clear)

  1. IMAP to IMAP by reaper20 · · Score: 2, Interesting

    I've done an IMAP to IMAP backup before with mozilla. Setup a new IMAP account in mozmail, and then do one huge drag and drop. It takes a while, but it works.

    Antother options, if you have a shell account and they setup maildirs in your /home, then all you really need to do is tarball that up.

  2. My personal solution: Squeak by RevAaron · · Score: 2, Interesting

    I came to a similar dillemma: I had amassed an amount of email which was pushing me over disk quota at my university. I could've deleted the email or my web page. Didn't sound like a good solution. The email wasn't critically important, but not worthless enough to just delete. But most of them also aren't so important that I need to read one of these old message too often. I was using pine on a Uni's Unix machine.

    I was long wanting to switch to the email client in Squeak, Celeste, as I spend most of my time in Squeak. I even telnet'd from it to access my email from within a client in Squeak.

    So, I setup Celeste to get my mail via POP. Had it download all my messages in my INBOX. Then, I downloaded the mail folders from the Solaris machine. Gzip and ftp. Celeste has the ability to import messages from Unix mailbox files. So I did that, into respective folders/categories. All done, less fuss than reading through the replies in this Ask Slashdot. :)

    Most clients can read mbox format.

    If you can't get to your raw mbox files, it would be easy to write a script to pull out messages via IMAP, and then output them to Unix mbox format. Then import. I was working on a similar thing before figuring out I could simply download my mbox files. I had written most of a script that went to the mail server, iterated over each mail category and saved it to the mail database. Squeak provides a nice MailDB class for it's own mail database format, so it was less than a dozen lines of code.

    --

    Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
  3. How about asking your mail admin? by Deagol · · Score: 3, Interesting
    As a mail admin, I've been contacted about this. I simply tar'ed up the tree and handed it to the user (so to speak -- I gave him a URL he could snarf it from his new location). He contacted his new mail admin and had him throw the files in place as-is.

    Of course, not all postmasters are that helpful :) But it never hurts to ask.

  4. use perl by mike_sucks · · Score: 2, Interesting

    While I never normally advocate the use of Perl for anything, I've had to do what you're looking for before, and I found the easiest way was to whip up a quick Perl script using libmail-imapclient-perl or libcyrus-imap-perl which recursively sucks your mail off the server.

    The advantages of doing this is that you can then save it into any format you want. I personally was using it to do a IMAP server to server copy, and it worked fantastically.

    If I still had the script, I'd post it, but it was many, many harddrives ago that I saw it last. :(

    /mike

    --
    -- "So, what's the deal with Auntie Gerschwitz et all?"