Howto migrate emails from Google to any IMAP Server
5th Jun 2024 | category: Emails | Hits: 729Google already has ready available tools to migrate emails from any IMAP server to Gmail, however I can not say the same with migration from Gmail or Google Google WorkSpace to any IMAP Server.
Well here at YIM, we bring you some steps to follow and script to configure so that your emails move onto your IMAP supporting server. These particular steps were done on a Zimbra linux Server
Step 1:
Create the OAUTH2 Keys to access Gmail as an Administrator.
As an administrator, you can use OAUTH2 (client ID and client secret ) to grant third-party and internal applications access to your users' data. Check out steps from Google here Google OAuth 2.0
Ensure you get a Client ID and Private key ID. Those allow access to all your migrated accounts and also creation of .json file which we will call in your script.
Step 2: Login into your IMAP server.
Create mykey.json file within your root account. Below is the sample file format.
Note: Do not alter
Step 3: Build a script sync.sh file
NOTE: You can copy the script as it is but change the logfile name (.txt), json file, domain name
Here is a simple script you need to set up to automatically move your emails from Google (Gmail) to your IMAP Server.
Create the OAUTH2 Keys to access Gmail as an admin. That allows you to access all accounts then create a .json file which you will call in your script
Otherwise you will need to specify even the gmail passwords