GMail Disaster Recovery | Syncing Mail.app to GMail IMAP
Alright, I guess the title says it all. As the Almighty Google slowly and surely taking full control of our online lives, it does once in a while remind some of us what that control means. On 30th December while I was actually searching an email in my GMail Inbox during a Skype session with Jo Vermeulen , suddenly all my emails (over 12K) disappeared including Sent emails. Jo immediately told me that it happened to many people before, and termed as “Gmail Disaster“. Well, there you go, free service comes with a price, is not it? Well done Google!! By the way did you guys notice that BETA term is not there anymore in the GMail site!
Anyway, as always my Apple Time Capsule and Machine played its role, so I could get hold of all my emails from Time Machine backup with in a few minutes by replacing two folders, /Library/Mail and /Library/Mail Downloads and by replacing the com.apple.mail.plist file residing in /Library/Preferences. Well, you can just replace /Library/Mail folder or even only the .mbox files in the /Library/Mail/Mailboxes folder.
So, I got my emails back and only needed to sync GMail IMAP with my local Mail.app by sending all my local emails back to the GMail server. However, while I tried to sync I faced some problems – even though my local Inbox and Sent folders had all the emails, as soon as Mail.app syncs with GMail IMAP all the local emails are deleted. There are some solutions addressing this problem that are discussed here. However if you have a large number of emails then creating folders and copying back and forth at realtime won’t just work. I did the following to sync local Mail.app to GMail IMAP, i.e., pushing all my local emails to GMail Server:
- Disconnect from the Internet.
- Restore Mail.app Backup.
- Create two new local folders under any MailBox other than GMail.
- Move all the messages from local GMail Inbox and Sent folders to these newly created folders.
- Connect to the Internet and Sync with GMail.
- Disconnect from the Internet.
- Move back all the incoming emails from newly created folder to Gmail Inbox.
- Connect to the Internet and Sync with Gmail. It will take quite a while depending on your connection, for my 12 K emails it took almost 4 hours.
- Disconnect from the Internet again.
- Move back all the outgoing emails from newly created folder to local Gmail Sent folder.
- Connect to the Internet and Sync with Gmail. Again it will take a couple of hours or longer.
- Finally, rebuild the MailBox Database for a sanity check by quitting Mail.app and running the following command from Terminal.
/usr/bin/sqlite3 ~/Library/Mail/Envelope\ Index vacuum
Anyway, until now I had huge confidence on Google, especially knowing their redundancy mechanisms, I guess that time has changed.
Sharing my view as being a developer.There are many email backup client available today. One of them is Beyond Inbox, which proving more than backup.
http://www.beyondinbox.com/documentation/mail-backup–features-and-benefits-of-beyondinbox.html