8

I currently use gmail, but this question is valid for any client: What is the best way to backup and store my email so that in the future I will be able to access it on a variety of platforms and clients.

Update:

While using gmail is certainly cross-platform and they have their own backup system, I am still looking to backup my email myself so that I can definitely know I have control over the backup and storage. I'm fine with letting gmail do it for now, but there's no guarantees.

2
  • 1
    When backing up Gmail without any Gmail-aware software, one might get duplicate messages due to Gmail's usage of labels. (Like a single Gmail message with multiple labels, appears to be multiple messages in different folders when using IMAP.)
    – Arjan
    Mar 23, 2010 at 18:12
  • 2
    As for backups: one might want to restore a single message one deleted by accident. (Especially when only noting the deletion after new messages have arrived.) Hence it would be nice if one can search for messages, and restore selected messages?
    – Arjan
    Mar 23, 2010 at 19:40

4 Answers 4

8

The two most common open formats for storing email are mbox and Maildir.

Both essentially just put the whole email (which is a stream of [ASCII] bytes) into a file. The only real difference is that mbox puts all emails into one file (concatenated, with a separator line), while Maildir puts all emails into one directory (hence the name :-)), but with one file per email.

Both are well supported by many programs, so both will do.

Both have some advantages and disadvantages in day-to-day handling; see the Wikipedia article for details. For archiving this should not be relevant, so either will do. Mbox is not really standardized (hence possibly compatibility problems), so I'd lean towards Maildir, but both are probably fine.

8

my solution has been getmail using imap and backing up to maildir. i then backup the maildir with crashplan to a remote drive.

3
  • It seems quite clear to me how you store email, but not so much how one can retreive it afterwards. Say I have a a cron-job running on a server to fetch all company email from our email hoster. The emails could then be deleted from the origin server and still stay in the backup server. But how would a client (say on a mac with normal end user software like Mail) connect to this and search for some specific email?
    – oligofren
    Oct 29, 2014 at 14:56
  • Have you setup an IMAP server?
    – oligofren
    Oct 29, 2014 at 15:15
  • I’d go with getmail + IMAP + Maildir as well. The configuration is a little work (once), but then running (from time to time) is just one command. Alteratives to getmail (other than the worse fetchmail) are offlineimap or imapsync.
    – caw
    Feb 21, 2022 at 18:09
3

I too use GMail and my answer is to have my own local IMAP server and to use fetchmail to retrieve the email and store a local copy. By using an IMAP server I can then use any mail client to access it, and by using an IMAP server that stores the emails as separate files (Cyrus IMAP) it means that even if the software fails I can still access the emails "by hand" if required.

For the really paranoid, using fetchmail with IMAP's idle command means that emails are downloaded when they arrive at GMail, keeping the window that you don't have a backup to a minimum.

6
  • When using IMAP to synchronise without backing up, manually deleted messages will be gone from both locations as soon as IMAP synchronisation takes place (like: immediately)... When using POP to feed the local IMAP server, the local IMAP server will have no notion about Gmail's labels and Deleted Items whatsoever, making restoring a backup a nightmare as the backup will then basically hold all messages one ever received?
    – Arjan
    Mar 23, 2010 at 18:16
  • @Arjan - my goal here is to have a solid, working, accessible backup of my email, not my email as gmail stores (i.e. labels, etc.). While that would be nice, you've already pointed out all the problems. Seems like the best bet would be to simply backup the All Mail folder/label. Am I correct in assuming this would have everyone email only once? Mar 24, 2010 at 21:42
  • However by using fetchmail it doesn't matter if the messages are deleted from GMail, there is no synchronisation of deleted messages, only new ones.
    – Cry Havok
    Mar 24, 2010 at 23:20
  • @Cry, but even if only all new messages are fetched, then the backup won't know what messages have been deleted at a later time. That's a lot of messages when one restores the backup?
    – Arjan
    Mar 25, 2010 at 6:16
  • @Arjan - make your mind up ;) Either you want to be able to restore deleted messages, or you don't.
    – Cry Havok
    Mar 25, 2010 at 7:13
1

The standard is called mbox format and it's as old as the internet. Many third party email clients will import this format directly (many also use it internally.) There are also utilities for converting this to various other formats.

2
  • I'm leaning towards using Thunderbird to download all email and then create yearly backups - so you would suggest using mbox files for those yearly backups. Mar 23, 2010 at 16:46
  • As all messages will be stored in a single file, this might not be the best choice for a backup. However, there's many tools available to fix corrupted mbox-files, so maybe it doesn't really matter.
    – Arjan
    Mar 23, 2010 at 18:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .