PROBLEM
I want to migrate from Gmail to my own Atmail server.
ENVIRONMENT
- On-Premise Server + WebMail Installations: Version 7.0 > Current Version
CAUSE
Migration requirement.
RESOLUTION
In cases where you need to move your Gmail accounts to an Atmail server, you can use IMAPSYNC (Using IMAPSYNC with Atmail) as a tool for migrating accounts. Unfortunately, GMail has a rather strange naming convention to folders, which you will need to account for during migration.
To make this process easier, we've made a quick bash utility which feeds off a CSV file and migrates the users. So to use this utility, please go through the following steps:
1. Install IMAPSync as per: Using IMAPSYNC with Atmail
2. Create a CSV file containing the following information:
user@gmail.com,password,user@atmail.com user1@gmail.com,password,user1@atmail.com user2@gmail.com,password2,user2.atmail.com
3. Replace the values with: a.) the GMail email account, b.) the password for both emails, and c.) the email account in Atmail.
4. Login to your Gmail Settings or Administration panel. Make sure that "IMAP Access" is turned on.
5. Create a file called gmail-to-atmail.sh. Make sure it contains the following:
#!/bin/bash # Get filename FILE=$1 # Define IMAP source host OLDHOST=$2 # Define IMAP destination HOST NEWHOST=$3 OLDIFS=$IFS IFS=, while read -r firstemail password secondemail do #imapsync /usr/bin/imapsync --noauthmd5 --syncinternaldates --host1 "$OLDHOST" --user1 "$firstemail" --password1 "$password" --port1 993 --ssl1 --host2 "$NEWHOST" --user2 "$secondemail" --password2 "$password" --regextrans2='s/\[Gmail\].//' --include "All Mail||Sent Mail" echo "OLDHOST: $OLDHOST" echo "NEWHOST: $NEWHOST" echo "SOURCE: $firstemail" echo "DEST: $secondemail" echo "PASS: $password" done < $FILE IFS=$OLDIFS
6. Save it, and apply the correct permissions:
% chmod 755 gmail-to-atmail.sh
7. Execute the command as follows:
% ./gmail-to-atmail.sh [csv file] imap.gmail.com [your imap host]
8. Replace the values as needed. For example:
% ./gmail-to-atmail.sh myusers.csv imap.gmail.com imap.atmail.com
Comments