This manual refers to an old version of CodeTwo Office 365 Migration. Go here if you use the latest version.

Connecting to a source IMAP server

Once the installation of CodeTwo Office 365 Migration is finished, you have to choose a source environment from which the data will be pulled and migrated to selected mailboxes in target Office 365. This article describes how to connect to a source IMAP server.


You must be aware that to migrate via IMAP you need to have credentials in hand for all accounts you are about to migrate. In one of the further configuration steps you will be asked to provide them in a form of a CSV file. It is not possible to provide only a whole organization administrator's credentials to access other users' mailboxes via IMAP due to the IMAP protocol limitations.

Configure your IMAP source

All IMAP accounts are supported - especially those hosted by well-known free mail providers such as Google or Yahoo. However, some providers have IMAP protocol disabled by default and you have to enable it manually prior to migration. Other restrictions may also apply, please refer to your mail provider for details on how to allow IMAP access.

Migrate from Exchange


If you are going to migrate from Microsoft Exchange Server, consider using an EWS or MAPI connection instead as it is a far more efficient way to migrate multiple accounts, unless you are about to migrate just a handful of mailboxes - then you can use IMAP.

Migration from Microsoft Exchange Server via IMAP might be a useful option for clients using hosted (e.g. Rackspace) or otherwise limited access Exchange Server. Before starting CodeTwo software configuration make sure you have enabled IMAP4 in your Exchange:

Migrate from Google

One of the most popular free as well as paid email accounts provider is Google with their Gmail service. Follow the steps below to be able to migrate from Google via IMAP:

  1. Log in to your Google account (whether Gmail or G Suite):
  2. Go to your account security settings:
  3. In the Apps with account access section set Allow less secure apps to ON.
  4. Now, go to your mail account Settings > Forwarding and POP/IMAP
  5. In the IMAP Access section, select the Enable IMAP option and click Save Changes.
  6. Go to the Labels tab and select the Show in IMAP checkboxes next to the names of labels you want to migrate.
  7. G Suite only: using the admin account, log in to Google Admin console, and go to Apps > G Suite > Gmail > Advanced settings. In the Organizations section select your organizational unit. Finally, next to POP and IMAP Access clear the Disable POP and IMAP access for all users checkbox.


If you do not enable Show in IMAP option, items labeled with such labels will not be migrated, unless they happen to be labeled twice or more and those other labels are visible via IMAP.


Google's Labels are visible as folders when accessing via IMAP. Therefore, after migrating via IMAP, you will have as many mailbox folders in the target mailbox as you have labels in your Google account. That's, of course, assuming you enabled IMAP visibility for all of them (see the Warning box above).

Items that are labeled with multiple labels will be migrated to each of the corresponding target folders. For example, if one of your emails is labeled as Important and Starred, and for both these labels the Show in IMAP option is enabled, after the migration you will find two copies of this email in your target mailbox: in the Important folder as well as in Starred folder.

Migrate from other IMAP sources

Pretty much any mail server is supported as a source of migration, providing that IMAP access is enabled and you are able to provide a list of credentials to access users' mailboxes. However, see the below notes for a few most popular mail services:

Configure the software

You can create a new source connection when you configure a migration job: click Create a new migration job on the How to start card (see Fig. 1.and select IMAP server. Then type the name of your job, and proceed to the Source mailboxes step. Select Add new source connection from the Source server list to open the source server connection wizardYou can also start the wizard by clicking the Settings (Office 365 Migration settings button temp) button on the Defined source server connections card (Fig. 1.and choosing New > IMAP server connection.

Office 365 Migration new source connection imap
Fig. 1. How to open the source connection wizard.

Either way, the IMAP source server connection wizard will open (Fig. 2.).

Office 365 Migration IMAP source wizard 1
Fig. 2. Configuring IMAP connection.

In the first step (Server connection) you need to provide the following information to configure IMAP connection:

  • IMAP server - you can use either IP address or its network name (e.g. For your convenience, we have added the most popular IMAP servers' addresses, including Gmail, Yahoo, and more.
  • TCP port - under which the IMAP server is running on the server. Usually, it is 993 for encrypted connections (SSL) and 143 for non-encrypted ones.
  • Secure connection - this option lets you decide if the connection should be encrypted.


Be advised, for mailboxes hosted in Google Apps with your custom domain you need to choose the same settings as for free Gmail accounts.


We strongly recommend using only encrypted (SSL) connections for your data safety. If you are not able to establish SSL connection to public IMAP servers (like Google or Yahoo), please check date and time in your system, as most probably there is an issue with SSL certificate. If still no joy, please contact your mail hosting provider.

Click Next to continue to the Throttling step (Fig. 3.). Here you can define how the program should limit connections to your IMAP server. Thanks to this feature, the program can suspend migration of mailboxes that exceeded server-side defined limits (if there are any) and continue the process for rest of them.

Office 365 Migration IMAP source wizard 2
Fig. 3. Configuring IMAP throttling.

Proceed by clicking Next, and finally click Configure, so the application will attempt to connect to the desired server. If the setup is successful (Fig. 4.), you are good to go and create a new IMAP job. 

Office 365 Migration IMAP source wizard 3
Fig. 4. Verification of IMAP connection.

When you complete the wizard, the new connection should be displayed on the Defined server connections card (Fig. 5.).

Office 365 Migration defined IMAP connection
Fig. 5. Defined source server connections.

See next

Configuring a migration job

Configuring source mailboxes for IMAP connection

Managing server connections

See also

Troubleshooting IMAP connectivity

Was this information useful?