New StackExchange: Astronomy

Just so that you know, there is a new StackExchange beta site: Astronomy. You can ask astronomy-related questions there, or search for questions other people have asked. Hopefully, you will get some good answers.


How to copy Mails from iCloud to GMail

You can use the fabulous imapsync tool to copy mails between IMAP servers. For example you can copy a certain folder from Apple's iCloud to Google's gmail:
imapsync \
   --noauthmd5 --ssl1 --ssl2 \
   --host1 mail.me.com --user1 'your.icloud.name' \
   --host2 imap.gmail.com --user2 'your.gmail.name@googlemail.com' \
   --folder 'your/folder/to/be/copied' --sep1 '/' \
   --prefix1 '' --prefix2 '[Google Mail]' --sep2 '/'
The important parts here are the user names for the IMAP servers. Note that you need to generate an application specific password, if you are using Google two factor authentication! Also important is the "[Google Mail]" IMAP prefix.

Edit: It seems gmail has a weird interpretation of all the IMAP folders and stuff. Since they are using labels, the above script might create a weird label for the copied emails, but they will be there nevertheless!