Saturday, September 26, 2009

Migrating from Gmail to Google Apps

Notes taken while I migrated from Gmail+Calendar+Contacts to Google Apps with equivalent features.

Migrate Emails

I used imapsync on Fedora 11 to do the dirty work of transferring emails from Gmail to Google Apps.  I used the script as defined by this blog.  I made some customizations to ease switching between multiple users that I transferred to Google Apps.

If you have access to a semi-recent version of Fedora you can install imapsync with "yum install imapsync".

Save the following script text to a file and "chmod 755 filename.sh".  Update the USER1 and USER2 lines with your account names.  You'll need to create two files called passfile1 and passfile2 that contain the passwords for each account.

Note: Compared to script from above log, I added --allowsizemismatch to get past some emails that somehow had wrong file sizes stored.   You may wish to try without that option first.

--- begin script ----
#!/bin/bash

USER1='user@gmail.com'
USER2='user@domain.com'
USER1E=`echo ${USER1} | sed 's/@/\\\\@/'`
USER2E=`echo ${USER2} | sed 's/@/\\\\@/'`
PASSFILE1=./passfile1
PASSFILE2=./passfile2
LOGFILE=imapsync.log

echo "***** Starting *****" > $LOGFILE

echo "" >> $LOGFILE

time imapsync --host1 imap.gmail.com \
  --port1 993 --user1 ${USER1}  \
  --passfile1 $PASSFILE1 --ssl1 \
  --host2 imap.gmail.com \
  --port2 993 --user2 ${USER2} \
  --passfile2 $PASSFILE2 --ssl2 \
  --syncinternaldates --split1 100 --split2 100 \
  --authmech1 LOGIN --authmech2 LOGIN \
  --useheader "Message-ID" \
 --useheader "Date" --skipsize --allowsizemismatch \
  --regexmess "s/Delivered-To: ${USER1E}/Delivered-To: ${USER2E}/gi" \
  --regexmess 's/Subject:(\s*)\n/Subject: (no--subject)$1\n/ig' \
  --regexmess 's/Subject: ([Rr][Ee]):(\s*)\n/Subject: $1: (no--subject)$2\n/gi' 2>&1 | tee -a $LOGFILE

echo "" >> $LOGFILE
echo "***** COMPLETE *****" >> $LOGFILE
echo "" >> $LOGFILE
--- end script ---

Migrate Calendars

Transferring your Primary calendar is hardest part.  If you have multiple calendars, the non-primary calendars can simply be Shared with the new Google Apps account and you will see no differences.  For your primary calendar, I found it easiest to save an ical version of events and then import it.

Use these steps to save save an ical version of your events from Gmail:  Under "My Calendars" list, click the Settings.  Under Settings, click on your primary calendar.  Towards bottom of new screen lists you "Private Address".  On the green ICAL icon, right click and click your Save Link As option (using Firefox anyways).

On your Google Apps calendar, click the Settings on your "My Calendars" list.  On next screen, there is an option to Import Calendar.  Select it and when prompted, give the filename of your ICAL saved in previous step.

Migrate Contacts

The follow info on contacts was taken from a blog also on migrating.

To preserve contact groups, each group needs to be migrated individually.
  1. On Google Apps mail, pre-create all your Groups that existed under Gmail.
  2. On GMail contacts, use the Export option to export each group in Google’s CSV format. Then export one more CSV of “Everyone (All Contacts)”
  3. On Google Apps contacts:

    1. Use the Import option to import the CSV of Everyone, leaving the  “Add these imported contacts to: ” option unchecked.
    2. Then use the Import option to import each group in turn, checking the “Add these imported contacts to:" and making sure to select the correct group name that was created in step #1.


Migrate iPhone

If you were using Google's Sync option for iPhone using Active Sync you were already pointing at the correct servers.  Just need to change Username from user@gmail.com to new user@domain.com and also the Password.


To be safe, I toggled OFF and then back ON the settings for Mail, Contacts, and Calendar and also selected "Delete from iPhone" when prompted.  This did a force resync of these items although calendar ended up empty.



You will also need to use Safari and browse to m.google.com/sync.  Look for instructions for configuring "Google Apps" and follow them.  You will need to do this to switch google sync to use your Google Apps calendars.

No comments:

Post a Comment