How to: migrating from GMail to MyKolab – part 3

Alastair Aitken 29 October 2013 1




This is part of a series, see Part 1 and Part 2. Here I detail my experience of migrating email from Google Apps to MyKolab.

Backup, backup, backup

I could have ignored performing a backup, after all a migration should only be reading from the source mailbox, but I like the metaphorical sartorial-ness of belts and braces, so I performed a backup and then tested that I could access the backup. The page I used as my guide for GMail backup appears to be down at the moment so I’ll do my best to recreate it here, with all credit due to the original author. The application for this process is getmail which runs on *nix and Mac and the following should create an MBOX file that you can open in an MBOX mail client such as Thunderbird.

Installation on a Mac is via MacPorts:

sudo port install getmail

I believe that the following should work on Debian:

sudo apt-get install getmail4

Then:

mkdir ~/.getmail
mkdir ~/Backup/gmail-archive
emacs -q -nw ~/.getmail/getmail.gmail

And put the following into ~/.getmail/getmail.gmail:

[retriever]
type = SimpleIMAPSSLRetriever
server = imap.gmail.com
username = email.address
password = my.password
mailboxes = ("[Gmail]/All Mail",)
[destination]
type = MultiDestination
destinations = ('[mboxrd-destination]', '[maildir-destination]')
[mboxrd-destination]
type = Mboxrd
path = ~/Backup/gmail-archive/gmail-backup.mbox
[maildir-destination]
type = Maildir
path = ~/Backup/gmail-archive/
[options]
# print messages about each action (verbose = 2)
# Other options:# 0 prints only warnings and errors
# 1 prints messages about retrieving and deleting messages onlyverbose = 2
message_log = ~/.getmail/gmail.log
# preserves your mail after backup
delete = false
# just get new mails 
read_all = false

Then:

touch ~/Backup/gmail-archive/gmail-backup.mbox
mkdir ~/Backup/gmail-archive/tmp ~/Backup/gmail-archive/new ~/Backup/gmail-archive/cur 
getmail -r $HOME/.getmail/getmail.gmail

And away you go. You should be able to connect to the resulting MBOX file with your mail reader.

Proper Planning Prevents Pathetic Performance

Before the actual migration I found that I had a bit of preparatory work to do.

IMAP? It no like ‘at sign’?

My GMail labels were named in a vaguely “Getting Things Done” (GTD) manner, so I had names such as ‘@Receipts’ as the ‘at sign’ would ensure that those folders were placed at the top of my GMail labels lists. However that ‘at sign’ causes folders to be ignored (by either imapsync or the target IMAP server, I’m not sure which), so they had to be renamed without the ‘at sign’.

Multiple labels is not IMAP?

In the IMAP world, messages exist in one folder and one folder only whereas in GMail messages can have many labels. Again, having followed a GTD ‘zero inbox’ method fairly religiously for a number of years, I’ve always given my emails a single label as soon as possible so I’ll be honest and say that I don’t know how this migration handles GMail messages with multiple labels. I suspect that the first time a message is encountered then whichever label is happens to have, then that’s the folder than it gets migrated too, but if anyone has a better understanding then it’d be good to hear.

Emigrate, immigrate, migrate

I think Oskar Hane has the best guide for migration from GMail to another IMAP server, but where I differed was by installing imapsync via Mac Ports:

sudo port install imapsync

Also, it never hurts to have more than one opinion, so take a look at How To Migrate Mailboxes Between IMAP Servers With imapsync too.

Running imapsync, I found out that I also needed to install/upgrade the Perl module Mail::IMAPClient, which I did using CPAN:

perl -MCPAN -e "install Mail::IMAPClient"

By now I could perform a test run of the migration:

imapsync --host1 imap.gmail.com --user1 test@gmail.com --password1 XXX --host2 imap.mykolab.com --user2 test@mykolab.com --password2 YYY --syncinternaldates --ssl1 -ssl2 --noauthmd5 --split1 100 --split2 100 --exclude All Mail --dry --justfolders

Once everything appeared to report back successfully I then migrated:

imapsync --host1 imap.gmail.com --user1 test@gmail.com --password1 XXX --host2 imap.mykolab.com --user2 test@mykolab.com --password2 YYY --syncinternaldates --ssl1 -ssl2 --noauthmd5 --split1 100 --split2 100 --exclude All Mail

Archive folder not created?

After a couple of days I noticed that there was no general ‘Archive’ folder in my MyKolab account.

Once I’d created a folder named ‘Archive’ I had to tell my iPhone and iPad to use this folder as the default archive folder (Settings > Mail, Contacts, Calendars > MyKolab (Mail) > Account > Advanced > Archive Mailbox).

What other ways can I do this?

It’s theoretically possible to add both a GMail IMAP account and a MyKolab IMAP account to, say, Thunderbird and drag-and-drop between the two. But I’ve not tried this – I like to see my programs reporting back to the command line with exactly what’s happening – so I can verify its efficacy.

I’m on Windows, what about me?

getmail and imapsync should run under Windows using Cygwin.

If you’re not comfortable with Cygwin (or want a simple solution) then the author of imapsync has a Windows executable available at a price of €50.

Post install

I still have my GMail account and I can still view my pre-migration emails, just in case anything was missed anything in the migration, and I have my backup but so far I’ve found nothing amiss.

How to: migrating from GMail to MyKolab – part 1

How to: migrating from GMail to MyKolab – part 2

How to: migrating from GMail to MyKolab – part 4




Alastair Aitken (124 Posts)

As a contract developer and manager I’ve worked in a wide range of enterprises in a variety of countries where I’ve encountered everything from great work, awful work, bizarre work, all the way down to quasi-legal work. If you think that you recognise your own organisation within my articles then you’re undoubtedly wrong, where you work isn’t that unique.

One Comment »

  1. Christoph 2 November 2013 at 5:56 pm - Reply

    For windows there is a graphical imapsync Tool availabe on Sourceforge: sourceforge.net/projects/rximapmail/

Leave A Response »