With the IMAP Email Migration feature, Microsoft 365 administrators can easily migrate user mailbox content from their previous mail server to Exchange Online. Source mail system can be Gmail, Yahoo or any private or public mail server supporting IMAP access.
Key limitations of IMAP migration to Microsoft 365:
- Only the emails and folders in the source mailboxes will be migrated. Contacts, calendars and tasks are not copied;
- Maximum email message size is 35 MB;
- Maximum 500,000 items per mailbox;
- No more than 50,000 mailboxes per batch migration job.
Prepare your Microsoft 365 environment before you start migrating. Create users and assign licenses to them. It is recommended (but not required) that the usernames in M365 match the email addresses on the source IMAP server.
To batch migrate IMAP users’ mailboxes to Microsoft 365, you can use a CSV file with the following header structure:
- EmailAddress — destination user’s mailbox in Microsoft 365;
- UserName — username on the source IMAP server;
- Password — password to connect to the source IMAP mailbox.
There must be no more than 50,000 lines in this CSV file. Use a comma as a delimiter in the CSV file.
Once you’ve completed the preparation steps, you’re ready to set up your Microsoft 365 migration job.
Go to Exchange Admin Center and configure IMAP migration endpoint:
- Navigate to Migration > click Endpoint in the top right-hand corner > Add;
- Select Migration type: IMAP;
- Specify the parameters for the connection to your source IMAP server:
IMAP server — enter the fully qualified domain name (FQDN) or IP address of your IMAP server. For Gmail, you must enter imap.gmail.com here;
Authentication — select authentication type (Basic or NTLM);
Encryption — if the IMAP server supports connection encryption, select SSL or TLS.
Port — default IMAP port is 143 and for IMAP SSL is 993.
You can use the cmdlet from the Exchange Online PowerShell module to check the availability of your source IMAP server:
Test-MigrationServerAvailability -IMAP -RemoteServer mail.nwtraders.com -Port 993 -Security SSL
You can create an IMAP migration endpoint using PowerShell:
New-MigrationEndpoint -IMAP -Name NMtradersIMAPEndpoint -RemoteServer mail.nwtraders.com:993/ssl
After Microsoft 365 checks the availability of your IMAP mail system, you can create a batch migration task.
- Go to Migration section in EAC and click Add migration batch;
Specify a unique name for the migration task and select:
Migration path: Migration to Exchange Online
Migration type: IMAP Migration
- Select the IMAP migration endpoint you created earlier;
- Import a CSV containing a list of IMAP user mailboxes that you want to migrate to EOL;
- The next step allows you to exclude some IMAP directories from the migration and to specify a time range for the email items to be migrated;
- Choose whether you want to migrate immediately, schedule it, or manually migrate later.
You can use PowerShell to create and run a batch migration task:
New-MigrationBatch -Name NWtradIMAPBatch1 -SourceEndpoint NMtradersIMAPEndpoint -CSVData ([System.IO.File]:: ReadAllBytes(“C:\PS\nwtradeIMAPmigration.csv”)) -AutoStart
Check the migration status:
Once the migration is complete, remove the batch job:
Remove-MigrationBatch -Identity NWtradIMAPBatch1
Confirm that all emails have been successfully migrated to your new Microsoft 365 mailboxes. Your users will need to manually recreate other mailbox items such as contacts, tasks and calendar items that were not migrated.