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?"

32 comments

  1. Outlook Express by anthony_dipierro · · Score: 0, Flamebait

    will do what you need

  2. 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.

    1. Re:IMAP to IMAP by hawkbug · · Score: 1

      Yeah, I was going to say - I was pretty sure I've downloaded all my imap stuff before with Mozilla. Although, if you can't figure out how to do that for some reason, here's a very easy solution: use mozilla to create a bunch of folders on your local machine - then go into each folder, highlight every message at once - and drag it over to the local folder. Yeah, it's a bit more work, but if you can't make the easy way work for you for whatever reason, this method will definitely work with Mozilla, or Netscape 4.7X for that matter.

  3. imapxfer by Alrescha · · Score: 4, Informative

    You might want to try imapxfer from the UW-IMAP toolkit:

    http://www.washington.edu/imap/

    The source for the utilities is at:

    ftp://ftp.cac.washington.edu/imap/imap-utils.tar .Z

    A.

    --
    ...bringing you cynical quips since 1998
  4. Yes, and kinda unrelated... by tenman · · Score: 1

    This is a good question. I too like to carry my mail around with me. I use an IMAP server, but the one that I need the data off of first is my Yahoo Mail account. I want to grab the 20+ Meg of messages that my account has collected over the years, and export them to a cd. I want to ween myself off of their massive MY! application. So, any way to take my mail/address book/notepad/breifcase/photos/etc with me? anyone? anyone?

    1. Re:Yes, and kinda unrelated... by balamw · · Score: 1
      I currently deliver all my e-mail from various sources including Yahoo to a Mercury/32 IMAP server running on my Win2000 box. This allows me to access my mail from my laptop over 802.11 while taking it off my ISPs servers...

      I have used fetchyahoo (http://fetchyahoo.twizzler.org), and yahoopops (http://yahoopops.sourceforge.net/) to get my mail from Yahoo, and freshmeat also lists another alternative http://mrbook.org/mrpostman/

      I currently use Izymail http://izymail.com since it handles both yahoo and hotmail in one small package. It also presents an IMAP interface to access subfolders on those accounts.

      You still have to move your mail from POP to IMAP, but that can be handled by most e-mail clients.

      Hope this helps.

      Balam

  5. fetchmail by Col.+Klink+(retired) · · Score: 0, Offtopic

    Can't you just run fetchmail deliver through procmail to any format you want?

    --

    -- Don't Tase me, bro!

  6. 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
  7. Use Evolution by nocomment · · Score: 1

    I've done exactly this before. (under gnome)

    I moved one IMAP tree from an old account directly into the new one. I'm not even sure if it downloaded locally first or just moved from one server to the next.

    Screw that outlook express peice of microsoft junk. Whose posting on slashdot lately?? ;-)

    --
    /* oops I accidentally made a comment, sorry */
    /* http://allyourbasearebelongto.us */
  8. freshmeat.net - search for IMAP copy by pbulteel73 · · Score: 4, Informative
    Just found this... don't know how well it works, but it looks like it does what you want.

    IMAP Copy

  9. Similar question, archiving? by Drakino · · Score: 1

    I'd like to archive some of my IMAP mail into a subfolder called "archive" with a duplicate tree layout under it. Anyone know an easy way to do this, while keeping mail that is not X days old where it is.

    1. Re:Similar question, archiving? by nocomment · · Score: 2, Insightful

      Do you have access to the server? You could do something like this in perl:

      ===BEGIN UNTESTED CODE BLOCK===
      #!/usr/bin/perl -w
      use File::stat;
      use strict;

      $username = ""; #Your username here
      my $fileLocation = "/home/username/Maildir/cur";
      my ($yearCreated,$year);
      print "Enter year to remove: "; chomp($year = );
      chdir "$fileLocation";
      while(){
      (undef,undef,undef,undef,undef,$yearCreated,undef) = localtime(stat($_)->mtime);

      if (!copy("$fileLocation/$_", "Archive/$fileLocation/$_")){
      print "Could not Move Files...Exiting...\n\n";
      exit;
      }else{
      print "$fileLocation Was Copied Successfully\n\n\n";
      }
      unlink "$fileLocation/$_" if ($year == ($yearCreated+1900));
      }

      If anyone cares to test it and correct it that would be nice...

      --
      /* oops I accidentally made a comment, sorry */
      /* http://allyourbasearebelongto.us */
    2. Re:Similar question, archiving? by Anonymous Coward · · Score: 0

      Set up an Outlook filter. An Outlook filter will let you copy any messages before xxx date into a separate folder.

      Outlook filters are, IMHO, one of the best reasons to use Outlook.

  10. isync (not the apple program) by Drakon · · Score: 2, Informative

    apt-get install isync
    pkg_add -r isync

    or go to
    http://www.cs.hmc.edu/~me/isync/

  11. I used Netscpae 4.7 mail client by neitzsche · · Score: 1

    The last time I had to use an exchange server, I used Netscape 4.7's e-mail client, created local folders, and dragged and dropped each folder from server to local machine folder by folder. Took about an hour for 400MB, IIRC.

    --
    "God is dead." - Frederik Nietzsche
  12. simple by Anonymous Coward · · Score: 0

    What's the problem? I'm a developer for one of the big name corporate mail servers out there and if you want to back up your personal IMAP account the easiest, you get a simple client like Mulberry or Mozilla, copy your entire IMAP tree to your LOCAL folders, zip and burn the Local mail folder from your user profile on your PC to a disc.

    When you're ready to move the mail back into active status, fire up your browser, connect to your new IMAP server and drag and drop the contents of your Local folder to your IMAP server folder in your email client.

    How did a question like this ever make it to slashdot? Jesus holy fucking christ.

  13. 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.

  14. rfc 2060 - all a nerd needs by DrSkwid · · Score: 1
    --
    There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
  15. there's lots of options... by obi · · Score: 3, Informative

    searching in my debian repo, I find:

    offlineimap - IMAP/Maildir synchronization and reader support

    http://gopher.quux.org:70/devel/offlineimap/

    isync - synchronize a local maildir with a remote IMAP4 mailbox

    http://www.cs.hmc.edu/~me/isync/

  16. fetchmail by Gadzinka · · Score: 1

    I believe that fetchmail would do the trick but you would have to tweak its configuration a bit.

    1. You would have to download every imap folder separatelly.

    2. Since default mode of operation for fetchmail is to retrieve mail from server and put it into local smtp system, you would have to direct it to deliver mail to procmail or other program, that would deliver messages to mbox or maildir.

    Robert

    --
    Bastard Operator From 193.219.28.162
  17. fastmail.fm by n-baxley · · Score: 1

    I just opened a guest account on freemail.fm today. I'm going to try it out to see how well it works. My other "free" IMAP account at freeshell has been unresponsive for 2 days, so I'm thinking of switching. Anyway, the point is that fastmail has a way to copy all of your imap content. It actually conects to your old account and uses some method to transfer them all, folders and all. I haven't tried it yet, since I can't connect to freeshell yet, but that might be an option if you're looking for another provider.

  18. 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?"
  19. Just use Netscape/OE and change offline settings by nyamada · · Score: 3, Informative

    In both OE and Netscape, you can change your preferences to save messages for "offline" viewing. If you do this, you can transfer all your IMAP folder messages to your computer that way. Prepare to wait awhile, if you've really got hundreds of messages.

    If you use NS, I think they're saved in mbox format. In any case, you then have them locally and can archive them from there (or transfer them to your new IMAP server).

  20. Re:Just use Netscape/OE and change offline setting by yancey · · Score: 1

    Absolutely. Not long ago I marked my entire work IMAP mailbox -- all 200 MB of it -- for off-line use in Mozilla while I was on a trip out of state. It works .. and it's always nice to have an off-site backup.

    --
    Ouch! The truth hurts!
  21. Evolution by Dunkirk · · Score: 1

    I just underwent a huge email tribulation at work. I've been on RedHat for about 5 years now, getting my corporate Exchange email through a variety of means. The lastest one was comprised of setting having fetchmail grab my mail from the Exchange server over IMAP, and filter it through spamassassin via procmail. Then I'd grab it through IMAP to my local machine, but the folders (except for the inbox, since this will NOT work) were all on an NFS mount to be backed up. Now I've installed Gentoo, and I wanted less fooling around with email. So I emerged evolution and really explored it. I've been using it at home for a long time now, but besides doing my IMAP mail at home (off my own email server), I like the Palm Pilot integration.

    What does this have to do with you? Sorry, I'm off track. What I found at work is that this thing is the Outlook Express of the Linux world. (If you've never really looked at OE, it's tough. Microsoft actually made a really good product, and then covered it up with their much less useful one, Outlook.) It does like 6 different mail methods, including maildir. (You never said what OS you're using, but I'm assuming it's Linux.) You can set Evolution up to have both your current IMAP server and a maildir heirarchy. (Just create ~/Maildir with /cur, /new, and /tmp subdirs.) Then just drag and drop. If you're on a slow link, it may take awhile, but you can control how this gets done. What I find in these situations is that this is a time for cleaning up. The other methods discussed here will probably be faster, but you probably won't streamline anything with the move.

    --
    Acts 17:28, "For in Him we live, and move, and have our being."
  22. Yet another way to do it. by Pointer80 · · Score: 1

    I'm in the middle of migrating a a few thousand accounts from Maildir format spools to Cyrus. I did some hunting on search.cpan.org and found Mail::IMAPClient. The documentation is very concise and the module works like a charm. :)

    That said, I think you could achieve your goal a lot easier with a run of the mill MUA like mozilla/evolution. If at first you don't succeed, google for a solution!

    /pointer

    --
    [%- PROCESS life -%]
  23. offlineimap rules ! by BigJim.fr · · Score: 1

    I run offlineimap from cron on a host at home to keep a backup copy of my mail. It maintains a maildir hierarchy of all my IMAP folders. Setup was quite stratightforward and took me about five minutes. In a word, offlineimap rules !

    http://gopher.quux.org:70/devel/offlineimap/

    And it is available in Debian.

    1. Re:offlineimap rules ! by Anonymous Coward · · Score: 0

      Correct me if I'm wrong, because I very well could be. However, isn't it useless to run IMAP then. I though IMAP was so your email was always stored on an IMAP server and then your email client queries the emails upon reading them, but your email stays fixed on the server until deleted.

    2. Re:offlineimap rules ! by BigJim.fr · · Score: 1

      > Correct me if I'm wrong, because I very
      > well could be. However, isn't it useless
      > to run IMAP then. I though IMAP was so your
      > email was always stored on an IMAP server and
      > then your email client queries the emails upon
      > reading them, but your email stays fixed on
      > the server until deleted.

      No, IMAP is still usefull :
      - I can access my whole mail tree through a web interface. And since I use server side filters (Sieve) my mail is always properly sorted.
      - I can log on any computer, unpack an IMAP client and I instantly have all my mail handy, with working filters too.
      - The backup trick would not work with POP : all messages would be backup up but the archive would grow indefinitely because the deletes on the server would not be reflected on the backup archive.

  24. Windows users can use The Bat! by RevRagnarok · · Score: 1

    In my endless pursuit for a decent IMAP client on Windoze (still using Eudora 4), I found a beautiful bug in The Bat!'s IMAP support - it treated IMAP as just another protocol to download the mail like POP and then happily cleared it from the server! :( - RR [Feel free to mod humorous]

    --
    I should put something clever here. Maybe someday.
  25. Hi. by generic-man · · Score: 1

    Hi. I asked this question.

    I managed to make a backup to local folders using Mulberry. Mozilla and Evolution, as suggested by several posters, simply wouldn't let me drag and drop a folder onto another. Mozilla would create an empty folder tree and copy INBOX. Evolution displayed its "you can't do this" cursor and produced an error message basically saying "you can't do this."

    --
    For more information, click here.