Two years ago, I transitioned from using regular Gmail (i.e. "…@gmail.com")
to setting up Google Apps for "nynim.org" (i.e. "…@nynim.org"). I had found
the following article back then which gave me helpful hints on how to use
imapsync to push data to my new Google Apps e-mail address:
I adapted that script for my own needs, and I was able to successfully copy all the mail from my regular Gmail account to my new Google Apps account.
Here is the final script I ended-up with:
--skipsize options are all recommended by the imapsync FAQ
(search for "Gmail"):
I opted to use the
--passfile1/passfile2 options rather than passing in a
plain-text password in via a command-line param for two reasons: first because
anyone with access to your system can use
ps to view active processes and
hence would see your password plain-as-day; second because it just better
abstracts the script-logic from the password-text, and we can control the
file-permissions of those password files.
All your Gmail labels should sync-over automagically. Since this is going Google-to-Google, because Google presents labels as separate IMAP folders in their Gmail IMAP implementation, the process above should sync and preserve all your Gmail labels for free.
It's been a two years since I've used this script, but I seem to remember it working pretty painlessly. I wanted to share it here for anyone else who might be looking to do this same thing.