Email Backup

Today I received an email asking for my support of a petition for Google to provide a way to backup your email. A way to download an archive of your emails so you can keep them on a cd or wherever. This petition is at:
http://computeruser.wordpress.com/2007/11/06/gmail-please-let-me-back-up-my-email/

I thought that sounded like a really good idea. Then I thought there *must* be a way to do this in Linux without a lot of fuss. After giving it a couple minutes more consideration, it hit me. You can use fetchmail to do this.

$fetchmail -a -u myname -k -p imap –bsmtp test.mail mailserveraddr

Will back up your IMAP email (while keeping a copy on the server) to a file called test.mail locally. Now this file, if broken up email by email, can easily be read by the likes of thunderbird (just name the files something.eml). I am sure other mail clients will have no trouble as well, or you can use your favorite text editor to read them (vim!)

The only piece I have not worked out yet is this. All the mails are saved in 1 text file, but to read the mails individually they need to be parsed out into separate files. I need to devise a way to do that. Any good ideas? It would be nice if I could find a way to get fetchmail to save them individually in a directory structure. Hmmmm……

2 Comments

  • DrHyde says:

    fetchmail saves all that email into an mbox file, which is readable by most mail clients as-is.

  • linc says:

    >fetchmail saves all that email into an mbox file, which is readable by most mail clients as-is.

    Right, and the “-bsmtp” saves it to what *looks* like an mbox file, however, without putting that in a mail directory (which you don’t have on a machine not running mail) I can’t seem to get it to import as an mbox file.

    Probably something I am doing screwey..

Leave a Reply

You must be logged in to post a comment.