{"id":24,"date":"2009-06-15T20:06:50","date_gmt":"2009-06-15T19:06:50","guid":{"rendered":"https:\/\/base6.com\/?p=24"},"modified":"2009-06-17T07:26:41","modified_gmt":"2009-06-17T06:26:41","slug":"migrating-from-gmail-to-google-apps","status":"publish","type":"post","link":"https:\/\/base6.com\/2009\/06\/15\/migrating-from-gmail-to-google-apps\/","title":{"rendered":"Migrating from GMail to Google Apps"},"content":{"rendered":"

A quick guide to migrating contacts, calendar, email and email filters from GMail (user@gmail.com<\/em>) to Google Apps<\/a> (user@domain.com<\/em>).
\n<\/p>\n

Calendar Entries<\/h3>\n
    \n
  1. On GMail calendar, goto Settings -> Calendars -> Export Calendars to download a ZIP of your calendars in ICAL format.<\/li>\n
  2. On Google Apps calendar, goto Settings -> Calendars -> Import calendar and import the ICAL entries to your calendar.<\/li>\n<\/ol>\n

    Contacts<\/h3>\n

    To preserve contact groups, each group needs to be migrated individually.<\/p>\n

      \n
    1. 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)”<\/li>\n
    2. On Google Apps contacts:\n
        \n
      1. Use the Import option to import the CSV of Everyone, leaving the\u00a0 “Add these imported contacts to: ” option unchecked.<\/li>\n
      2. Then use the Import option to import each group in turn, checking the “Add these imported contacts to: New Group… ” option, and enter the name of the group.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n

        Google Sync<\/h3>\n

        At this point you might want to switch Google Sync over to your Google Apps account. Follow the steps here<\/a>, but enter your Google Apps email address instead of your GMail address. You then need to go through the steps here<\/a> and sign in with your Google Apps account to select which calendars to sync. Remember to click the “Google Apps User?” link rather than trying to go through the normal GMail login page – your Google Apps email will not work there!<\/p>\n

        Email Filters<\/h3>\n

        If you have any rules defined to filter\/label your incoming mail, you can export these using\u00a0 “Filter import\/export” in GMail labs:<\/p>\n

          \n
        1. Go to Settings -> Labs and check “Enable” for the “Filter import\/export” option on both your GMail and Google Apps account.<\/li>\n
        2. In your GMail account, go to Settings -> Filters, click Select All and then Export, and save the XML document somewhere.<\/li>\n
        3. In your Gogle Apps account, go to Settings -> Filters and then “Import filters”, select the file you saved in the previous step, and press “Open file”.<\/li>\n<\/ol>\n

          Email Delivery<\/h3>\n

          You should now be ready to switch over your email. Hopefully your MX records already point at Google Apps and you have email forwarding set up from Google Apps to your GMail. If you don’t, you should set this up before you start trying to move your email.<\/p>\n

          Now is when you must commit to migrating by having all your new mail delivered to Google Apps instead of GMail!<\/p>\n

            \n
          1. Login here<\/a>, select “Manage this domain”, and ensure that in Users and Groups you have a user set up for the Google Apps email address you want to migrate your GMail to. If you created a group to forward the email address to GMail you will need to delete this group before you can create the user.<\/li>\n
          2. Use the Inbox link at the top right to log in to the mailbox for the user (signing out if you are not currently logged in as that user).<\/li>\n
          3. Send a test email to your Google Apps email address to ensure that you are receiving email correctly.<\/li>\n
          4. Log in to your GMail account, go to Settings -> Forwarding and POP\/IMAP and enable forwarding to your Google Apps address.<\/li>\n<\/ol>\n

            You should now be receiving all your email in your Google Apps mailbox. You may also need to update POP3\/IMAP settings for any mail clients you are using.<\/p>\n

            Old Emails<\/h3>\n

            The hardest part is now to migrate your old emails from your GMail mailbox to Google Apps. Google provide a number of officially supported options<\/a>, however none of these are ideal – Mail Fetcher<\/a> is only intended for new emails rather than migrating old emails, Email Uploader<\/a> requires you to have all your email in Outlook, and IMAP Mail Migration<\/a> requires you to upgrade to Google Apps Pro (but looks like a pretty good option other than that).<\/p>\n

            I decided to go for a free approach, using imapsync<\/a> based upon these instructions<\/a>. However I found that imapsync would frequently give up without copying the entire folder. I initially thought this was because the number of messages was too large, so I used the following script to split the mail into chunks by folder and also by date. I also tweaked the regexes to rewrite To\/From\/CC\/BCC headers, and to be a little more tolerant of malformed headers:<\/p>\n

            \n
            #!\/bin\/bash\r\n\r\nLOGFILE=imapsync.log\r\nFOLDERS=( 'Folder1' 'Folder2' 'Folder3' 'Folder4' '...' 'FolderN' 'INBOX' 'All Mail' 'Bin' 'Drafts' 'Starred' 'Sent Mail' )\r\nTIMES=( '--minage 1090' '--maxage 1091 --minage 999' '--maxage 1000 --minage 908' '--maxage 909 --minage 817' '--maxage 818 --minage 726' '--maxage 727 --minage 635' '--maxage 636 --minage 544' '--maxage 545 --minage 453' '--maxage 454 --minage 362' '--maxage 363 --minage 271' '--maxage 272 --minage 180' '--maxage 181 --minage 89' '--maxage 90' )\r\n\r\necho \"Starting\" > $LOGFILE\r\n\r\nfor FOLDER in \"$@\"\r\ndo\r\n for ((j=0;j<${#TIMES};j++))\r\n do\r\n TIME=${TIMES[${j}]}\r\n\r\n echo \"\" >> $LOGFILE\r\n echo \"*** $FOLDER $TIME ***\" >> $LOGFILE\r\n echo \"\" >> $LOGFILE\r\n\r\n while ! ~\/imapsync-1.267\/imapsync --host1 imap.gmail.com \\\r\n --port1 993 --user1 user@gmail.com \\\r\n --passfile1 .\/passfile --ssl1 \\\r\n --host2 imap.gmail.com \\\r\n --port2 993 --user2 user@domain.com \\\r\n --passfile2 .\/passfile --ssl2 \\\r\n --syncinternaldates --split1 100 --split2 100 \\\r\n --authmech1 LOGIN --authmech2 LOGIN \\\r\n --include \"$FOLDER\" \\\r\n $TIME \\\r\n --useheader \"Message-ID\" \\\r\n --useheader \"Date\" --skipsize \\\r\n --regexmess 's\/Delivered-To: user\\@gmail.com\/Delivered-To: user\\@domain.com\/gi' \\\r\n --regexmess 's\/<user\\@gmail.com>\/<user\\@domain.com>\/gi' \\\r\n --regexmess 's\/^((To|From|Cc|Bcc):.*)user\\@gmail.com(.*)$\/$1user\\@domain.com$3\/gim' \\\r\n --regexmess 's\/Subject:(\\s*)\\n\/Subject: (no--subject)$1\\n\/ig' \\\r\n --regexmess 's\/Subject: ([Rr][Ee]):(\\s*)\\n\/Subject: $1: (no--subject)$2\\n\/gi' >> $LOGFILE 2>&1; do\r\n echo \"\" >> $LOGFILE\r\n echo \"***** NOT COMPLETE - $FOLDER $TIME *****\" >> $LOGFILE\r\n echo \"\" >> $LOGFILE\r\n tail -100 $LOGFILE | mail -s \"Imapsync Restarting for $FOLDER $TIME\" \"user@domain.com\"\r\n\r\n echo -n \"Sleeping...\" >> $LOGFILE\r\n sleep 1m\r\n echo \"Done.\" >> $LOGFILE\r\n done\r\n\r\n echo \"\" >> $LOGFILE\r\n echo \"***** COMPLETE - $FOLDER $TIME*****\" >> $LOGFILE\r\n echo \"\" >> $LOGFILE\r\n tail -100 $LOGFILE | mail -s \"Imapsync Complete for $FOLDER $TIME\" \"user@domain.com\"\r\n done\r\ndone\r\n\r\necho \"**** DONE ****\" >> $LOGFILE\r\ntail -100 $LOGFILE | mail -s \"Imapsync Complete\" -c \"user@domain.com\"<\/pre>\n<\/blockquote>\n

            The script writes to a logfile, and emails the last 100 lines upon completion. I found this useful as some messages could not be copied. After some debugging I was able to locate these by searching for the Message-ID in my GMail to discover that they were all old messages imported from Outlook which had corrupted headers (newlines inside the header, so the Message-ID could not be found by imapsync). Manually deleting the corrupted messages from my GMail allowed the sync process to complete.<\/p>\n","protected":false},"excerpt":{"rendered":"

            A quick guide to migrating contacts, calendar, email and email filters from GMail to Google Apps.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[30,31,32],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/base6.com\/wp-json\/wp\/v2\/posts\/24"}],"collection":[{"href":"https:\/\/base6.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/base6.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/base6.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/base6.com\/wp-json\/wp\/v2\/comments?post=24"}],"version-history":[{"count":14,"href":"https:\/\/base6.com\/wp-json\/wp\/v2\/posts\/24\/revisions"}],"predecessor-version":[{"id":39,"href":"https:\/\/base6.com\/wp-json\/wp\/v2\/posts\/24\/revisions\/39"}],"wp:attachment":[{"href":"https:\/\/base6.com\/wp-json\/wp\/v2\/media?parent=24"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/base6.com\/wp-json\/wp\/v2\/categories?post=24"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/base6.com\/wp-json\/wp\/v2\/tags?post=24"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}