Skip to content

Instantly share code, notes, and snippets.

@masnick
Last active August 21, 2022 19:48
Show Gist options
  • Save masnick/5239278 to your computer and use it in GitHub Desktop.
Save masnick/5239278 to your computer and use it in GitHub Desktop.

Proceed at your own risk. Back up. Don't blame anyone but yourself if you lose all your email or send your personal information to a nefarious third party.

Source: http://hynek.me/articles/fleeing-from-gmail/

  1. On a VPS to increase speed (I used a Digital Ocean VPS):

     wget http://imaputils.googlecode.com/svn-history/r5/trunk/imapcopy.pl
    
  2. Create a text file called map with the following contents:

     [Gmail]/Sent Mail:Sent Items
     [Gmail]/All Mail:Archive
    
  3. Using screen, open up some stunnels. In two separate windows (so both continue to run):

     stunnel -c -f -d 1143 -r imap.gmail.com:993 -P ''
     stunnel -c -f -d 1144 -r fastmail.fm:993 -P ''
    

Note that you may need to replace fastmail.fm with mail.messagingengine.com.

  1. In yet another screen window run the following, replacing the user-specific stuff as necessary (including an app-specific password if you're using 2-factor authentication for Google):

     perl imapcopy.pl \
       -S localhost:1143/[email protected]/google.password \
       -D localhost:1144/[email protected]/new.password \
       -M map -m "[Gmail]/All Mail,[Gmail]/Sent Mail"
    
  2. Wait. This may take several hours (I left it running all night for 55,000+ messages). When you're done, change your Google and FastMail passwords for security purposes (or delete your app-specific Google password).

@saidaspen
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment