How to migrate IMAP email to Microsoft 365
Move mailboxes from a web host, cPanel server, Zoho Mail or any IMAP service into Exchange Online using Microsoft's built-in IMAP migration, then switch MX without losing mail.
How do you migrate IMAP email to Microsoft 365?
This moves email from a web host, cPanel server, Zoho Mail or another IMAP service (the standard way mail apps read a mailbox) into Microsoft 365. Microsoft's built-in IMAP migration copies each mailbox's mail folders and keeps copying new mail until you switch over.
- Recommended route: Microsoft IMAP migration batch (built into Exchange Online)
- Order: Create the new mailboxes first, prove the copy on a pilot, then copy everyone while mail still arrives at the old host.
- 7 phases: Get ready, Set up Microsoft 365, Prepare passwords and CSV, Copy the mail, Move contacts and calendars, Switch over and Check and clean up.
- You're done when: Every mailbox shows Synced with no errors, and its folders match the old webmail.
Contacts and calendars do not move, so you export and import those yourself. Allow at least a few days: the first copy runs in the background, and the batch should keep copying new mail for at least 72 hours after the switch.
Included with Exchange Online at no extra charge, runs from the Exchange admin center, and keeps copying new mail about once a day until you delete the batch.
Other options and when to use them
- PST export and import: A few mailboxes break the size or item limits, or the host blocks Microsoft's connection.
- Third-party tool such as CodeTwo Office 365 Migration or MigrationWiz: The host cannot cope with the native copy, or you need date filters or jobs that run only overnight.
- Microsoft's Google Workspace or Exchange migration: Your old email is Google Workspace or Exchange Server. Those tools also move calendars and contacts.
Create the new mailboxes first, prove the copy on a pilot, then copy everyone while mail still arrives at the old host. Change the MX record (the DNS setting that tells the internet where to deliver your email) only once the copies are in place, and cancel nothing until the last top-up copy has run.
- Inventory of mailboxes, shared addresses and anything else that sends as your domainIt tells you which users and shared mailboxes to create, which rows go in the migration CSV file, and which forms and scanners must be repointed later.
- Lower the MX record TTL and save the current DNS recordsTTL is how long other systems cache your record. A short TTL takes effect only after the old one runs out, so do it days ahead. The saved records are your way back.
- Domain, users and shared mailboxes in Microsoft 365 (MX unchanged)The batch can only copy into mailboxes that exist. Leaving MX alone keeps mail arriving at the old host, so nothing is missed during the copy.
- Passwords (or app passwords), endpoint and a pilot batch of two or three mailboxesProves the server settings and sign-ins, and shows whether the host blocks or slows Microsoft, before you commit everyone.
- Batches for everyone else, large mailboxes outside business hoursThe first copy is the slow part. Doing it while people still use the old webmail means no downtime, and the batch then tops up daily.
- Contacts, calendars, rules and signatures, in the switch-over weekThe batch does not copy them. Exporting close to the switch catches recent changes, and it must happen before the old service closes.
- MX and SPF change, repointed forms and scanners, then devices the next dayMailboxes are already full when mail starts arriving, other senders keep passing SPF, and devices download from the new account only once.
- Keep the batch 72 hours, check, then delete it and cancel the old hostSome senders use the old MX for up to 72 hours, and the batch copies that mail. Deleting the batch ends the copy and your easy way back.
Built-in and third-party tools treat these differently. Tick each one off once you have decided.
Download this checklist (Excel)How each tool handles it
Built-in methodBuilt-in IMAP batch: copies only mail in the inbox and other mail folders. Microsoft states it does not move contacts, calendar items or tasks. Filters, signatures and automatic replies are not mail items, so they stay behind too.CodeTwo Office 365 MigrationReads the source over IMAP, which carries mail only. Plan contacts and calendars separately.audrigaAlso copies contacts and calendars, from Roundcube or Horde webmail or over CardDAV and CalDAV, where the old host offers them. Test one account first.Tip: Export each user's contacts (CSV or vCard) and calendar (.ics) from the old webmail before cutover. Outlook imports contacts from CSV only.
Microsoft Learn: Migrate your IMAP mailboxes to Microsoft 365How each tool handles it
Built-in methodBuilt-in IMAP batch: copies up to 500,000 items per mailbox, newest first. Anything past that is not copied. There is no date filter.CodeTwo Office 365 MigrationA time filter excludes items older or newer than a date you set, so old mail can follow in a later pass or stay behind.MigrationWizAdvanced Options set the earliest and latest date to migrate.Tip: Check item counts in the inventory. For a mailbox near the limit, export older mail to PST in classic Outlook (the older Outlook for Windows desktop app) and import it into the archive mailbox.
Microsoft Learn: Migrate your IMAP mailboxes to Microsoft 365How each tool handles it
Built-in methodBuilt-in IMAP batch: the largest message it copies is 35 MB. Larger messages are skipped.CodeTwo Office 365 MigrationAdvanced settings let you set the largest item size to migrate.PST import (Microsoft Purview)Skips only items over 150 MB, and raises the mailbox receive limit to 150 MB when it needs to.Tip: Ask users to save attachments from very large messages to OneDrive before the old account closes.
Microsoft Learn: Migrate your IMAP mailboxes to Microsoft 365How each tool handles it
Built-in methodBuilt-in IMAP batch: copies every folder unless you exclude it under Migration filtering options in the batch wizard (ExcludeFolders in PowerShell), using folder names as the IMAP server shows them. Microsoft says folders with a forward slash (/) in the name are not migrated.CodeTwo Office 365 MigrationA folder filter excludes chosen folders completely.MigrationWizFilters folders with regular expressions (text patterns).Tip: Ask users to empty Trash and Junk in the old webmail first, and rename any folder with a / in its name.
Microsoft Learn: Tips for optimizing IMAP migrationsHow each tool handles it
Built-in methodNot stated in Microsoft's documentation: test it in your pilot.CodeTwo Office 365 MigrationNot stated in CodeTwo's documentation: test it in your pilot.MigrationWizNot stated in BitTitan's documentation: test it in your pilot.Tip: In the pilot, compare a few folders in Outlook on the web with the old webmail: unread counts, flagged messages and dates.
Microsoft Learn: Migrate your IMAP mailboxes to Microsoft 365How each tool handles it
Built-in methodBuilt-in IMAP batch: signs in as each user with the password in the CSV file. Microsoft documents admin (master) sign-in formats only for Exchange, Dovecot and Mirapoint servers, and says some servers, such as Courier IMAP and Oracle IMAP, do not support it.CodeTwo Office 365 MigrationAlso takes each mailbox login and password from a CSV file.Tip: Check whether the host needs app passwords (separate passwords for mail apps) when two-step sign-in is on. Otherwise tell users first, reset passwords in one sitting, and reset them again after the batch is deleted.
Microsoft Learn: Migrate other types of IMAP mailboxesHow each tool handles it
Built-in methodMicrosoft 365: each person needs a licence that includes Exchange Online. A shared mailbox needs no licence, and each user can have up to 400 aliases. The batch copies into the mailbox named in each CSV row, so that mailbox must exist first.Tip: Licence only real people. Point the CSV row for a shared login at its shared mailbox.
Microsoft Learn: Create a shared mailboxHow each tool handles it
Built-in methodBuilt-in IMAP batch: the migration endpoint (the saved connection to the old server) sets how many mailboxes copy at once (MaxConcurrentMigrations in PowerShell), and you can lower it. There is no setting to run only in certain hours. Microsoft advises raising source connection limits and running small test batches to measure speed.CodeTwo Office 365 MigrationSets how many mailboxes migrate at once, has a throttling step for IMAP servers that limit connections, and a Scheduler that runs jobs only in the hours you choose.MigrationWizSets how many migrations run at the same time.Tip: Start large batches outside business hours, and run several small batches rather than one big one.
Microsoft Learn: Tips for optimizing IMAP migrationsHow each tool handles it
Built-in methodBuilt-in IMAP batch: after the first copy it syncs new mail about once a day until you delete the batch. Microsoft says to keep it running for at least 72 hours after the MX change. Deleting the batch stops the copying for good.CodeTwo Office 365 MigrationA delta pass (a top-up copy of only what changed) copies only new items, not changed ones.Tip: Ask users not to change their old password until the batch is deleted. Microsoft warns that new mail on the old server then stops being copied.
Microsoft Learn: Migrate other types of IMAP mailboxesHow each tool handles it
Built-in methodMicrosoft's migration tool does not know about retention (MRM) or archive policies. Items they delete or move during the copy are reported as missing. Microsoft strongly recommends turning these policies off before migrating.Tip: A new Microsoft 365 setup usually has none. Check under Microsoft Purview > Data lifecycle management before the first batch.
Microsoft Learn: Migrate your IMAP mailboxes to Microsoft 365
- 1
Get ready
Before you startWatch out: Some hosts block connections from outside their country, which stops Microsoft reaching the server.
Ways around it
- Ask the host to allow it, or use PST export and import (a one-off copy through Outlook on a PC).
Check your DNS records before and after the change
Show the detailed steps (4) → - 2
- 3
Prepare passwords and CSV
Show the detailed steps (3) →Watch out: Built-in IMAP batch: it signs in as each user, so it needs every mailbox password.
Ways around it
- Reset passwords for the migration, and again after the batch is deleted.
- Ask whether the host supports an admin sign-in over IMAP. Shared hosting rarely does.
- 4
Copy the mail
Watch out: Built-in IMAP batch: each mailbox copies up to 500,000 items, newest first, with no date filter. Messages over 35 MB are skipped.
Ways around it
- Export older mail from very large mailboxes to PST and import it into the archive mailbox (extra online-only storage).
- Save attachments from messages over 35 MB by hand.
Tools that can do it
- CodeTwo Office 365 MigrationFilters by date and folder, with delta passes (top-ups) for new mail.
- MigrationWizSets the earliest and latest date to migrate. Since 1 October 2026 you must first add its app ID to the tenant's EWS (Exchange Web Services) allow list.
Show the detailed steps (4) →Watch out: Host connection limits slow the copy. Built-in IMAP batch: you can lower how many mailboxes copy at once in the migration endpoint settings, but you cannot limit it to certain hours.
Ways around it
- Ask the host to raise its limits, lower the endpoint's concurrent migrations if connections fail, and run several small batches.
Tools that can do it
- CodeTwo Office 365 MigrationSets how many mailboxes run at once, handles throttling servers, and schedules jobs overnight.
- 5
Move contacts and calendars
Before the old service closesWatch out: Built-in IMAP batch: contacts, calendars and tasks are not copied, and they are lost when the old account is cancelled.
Ways around it
- Export and import by hand as above (free, fine for a few users), and recreate tasks.
Tools that can do it
- audrigaCopies contacts and calendars over CardDAV and CalDAV or from Roundcube webmail, where the old host offers them. Test one account first.
Watch out: Imported calendar events do not update if the organiser changes them later.
Ways around it
- Ask organisers to resend important recurring meetings from Outlook.
Show the detailed steps (3) →Watch out: Outlook imports contacts from CSV, not vCard (.vcf).
Ways around it
- Open the .vcf in a desktop mail client and export it to CSV.
- 6
Switch over
After the first copy shows SyncedWatch out: Old IMAP accounts on PCs and phones cannot be converted, so each device downloads the whole mailbox again.
Ways around it
- Remove the old account, add the new one, and leave PCs on overnight.
Watch out: Other mail systems can take up to 72 hours to see the new MX, so some mail still reaches the old host.
Ways around it
- Leave the batch running: it copies new mail about once a day until you delete it.
Turn this phase into dated tasks with the cutover planner
Show the detailed steps (4) → - 7
Check and clean up
72 hours after the switchShow the detailed steps (4) →Watch out: Microsoft has no tool to copy mail back to an IMAP server, and cancelling the old host removes its mailboxes.
Ways around it
- Keep the old host and your saved DNS records until every mailbox is checked.
- To roll back, restore the old MX and drag new mail back in classic Outlook (the older Outlook for Windows desktop app).
- Every mailbox shows Synced with no errors, and its folders match the old webmail.
- Outside mail arrives in Microsoft 365, and replies pass SPF, DKIM and DMARC sender checks.
- Every user sends and receives on desktop and phone with the Microsoft 365 account.
- Contacts and calendars are in Outlook, and no new mail has reached the old host since the MX change.
Tools named in this plan are independent third-party products, not endorsed by the platform vendor and not paid placements. Check the tool's own documentation and run a pilot first.
What does each step involve?
Open a part when you reach it in the plan. Each step says where to go, what to do and what you should see.
About this migrationWhat it covers, limits at a glance
IMAP migration copies email from any server that supports IMAP into Exchange Online mailboxes. It suits small businesses leaving shared hosting (cPanel and similar), Zoho Mail and other providers. It is not a full migration: Microsoft states it does not move contacts, calendar items or tasks, so plan to export and import those separately.
If you are moving from Google Workspace, use the Google Workspace guide, which uses Microsoft's dedicated Google migration and moves calendars and contacts too. For Exchange Server, see the Exchange to Exchange Online guide.
1What you need before step one
| Need | Details | Where to get it |
|---|---|---|
| Microsoft 365 Global Administrator | To add the domain, create users and assign licences. An Exchange Administrator can run the migration steps. | Microsoft 365 admin center, https://admin.microsoft.com |
| Licences | One licence that includes Exchange Online for each person. Shared mailboxes do not need one. | Microsoft or a partner; check current pricing with them |
| Source IMAP server details | Server name, port and encryption for the current host. | Find your IMAP settings |
| Each source mailbox password | IMAP migration signs in as each user. Some hosts need an app password for IMAP. | Your current host's control panel or each user's security settings |
| DNS access | Login to wherever your DNS is hosted (registrar, web host or DNS provider). | Run nslookup -type=ns contoso.com to see who hosts it |
| Optional: Exchange Online PowerShell | Only if you prefer commands to the admin center. | Connect to Exchange Online PowerShell |
2Create users and mailboxes in Microsoft 3653 steps
- 1
Add and verify your domain
Where: Microsoft 365 admin center (admin.microsoft.com) > Show all > Settings > Domains > Add domainType the domain (for example
contoso.com) and select Next. Choose the TXT record option and select Next. At your DNS host, create a TXT record with exactly the host andMS=ms...value the wizard shows, then return and select Verify. When the wizard asks how to add DNS records, choose I'll add the DNS records myself, then More Options > Skip this for now. Do not change MX yet: the old host keeps receiving mail during the copy. Full detail: add a domain to Microsoft 365.nslookup -type=TXT contoso.comYou should see: The domain appears on the Domains page as verified, and nslookup -type=mx still returns the old host's MX record. - 2
Create users and assign licences
Where: Microsoft 365 admin center > Users > Active users > Add a user (one person) or Add multiple users (CSV)The mailboxes must exist before IMAP migration can copy into them. For each person, select Add a user, enter the name, type the username and pick your domain from the domain list so the address matches the one they use today, then select a location and a licence that includes Exchange Online and finish the wizard. For more than a few people, select Add multiple users, choose I'd like to upload a CSV with user information, download the blank CSV, keep its header row, fill one user per row (up to 249 users per file) and upload it; see bulk create users and assign licences.
You should see: Each user is listed on Active users with a licence, and after a few minutes can sign in at https://outlook.office.com to an empty mailbox. - 3
Create shared mailboxes for shared accounts
Where: Microsoft 365 admin center > Teams & groups > Shared mailboxesAccounts such as info@ or accounts@ are often shared on the old host. Select + Add a shared mailbox, enter a name, edit the email address so it matches the old address, and select Save changes. Under Next steps select Add members to this mailbox, then Add members, pick the people and select Add. Shared mailboxes do not need a licence.
You should see: The shared mailbox is listed on the Shared mailboxes page with its members.
3Collect source server details and credentials4 steps
- 1
Find the IMAP server name and port
Where: Your current host's control panel (cPanel: Email > Email Accounts > Connect Devices; Zoho Mail: Settings > Mail Accounts > your address > IMAP)Copy the incoming IMAP server name, port and encryption. In cPanel the values are under Mail Client Manual Settings > Secure SSL/TLS Settings: Incoming Server and IMAP port 993. Zoho shows the server under Server Configurations Details. Rackspace lists
secure.emailsrvr.com, port 993, SSL. Use SSL on port 993 where the host supports it. For other providers see find your IMAP settings.You should see: You have a server name (for example mail.contoso-host.com), port 993 and SSL recorded in your mailbox inventory. - 2
Get each mailbox password
Where: Your old host's control panel (cPanel: Email > Email Accounts > Manage > Security), and a protected spreadsheet on your admin PCMost hosts do not offer admin impersonation over IMAP, so you need each user's password. Either collect them securely or set a new password for each mailbox on the old host for the migration. Use app passwords where the host requires them for IMAP (Zoho does when two-factor authentication is on). Test one account by signing in to the host's webmail with the full email address and the password.
You should see: Every mailbox in your inventory has a password that opens its webmail. - 3
Check connection limits
Where: Your host's support channel (ticket, chat or phone)Microsoft notes that connection limits on the source (per user, per IP or total) slow migrations. Ask your host what limits apply to IMAP connections and whether they can raise them for the migration period. Ask too whether they block connections from outside your country, which stops Microsoft reaching the server.
You should see: A written reply from the host with the limits, and any change they have made. - 4
Lower the MX TTL
Where: Your DNS host's control panel > your domain > DNS records > MX record > EditSet the TTL on each MX record to 3,600 seconds or less before you start, as Microsoft recommends, and select Save. Wait at least as long as the old TTL before the cutover. Full detail: lower DNS TTL before a migration, and the DNS cutover guide.
nslookup -type=ns contoso.com nslookup -debug -type=mx contoso.comYou should see: The MX record shows a TTL of 3600 or lower in the control panel, and the ttl = line in the nslookup -debug output matches.
4Build the migration CSV3 steps
- 1
Use the exact headers
Where: Excel or Notepad on your admin PC, saved as CSV (for example C:\migration\imap-pilot.csv)The file needs three columns, with no spaces in the headings:
EmailAddress(the Microsoft 365 mailbox, as shown on Users > Active users),UserName(the IMAP sign-in name) andPassword. One row per mailbox, up to 50,000 rows and 10 MB. In Excel, use File > Save As and choose CSV. You can also download a CSV with headers from the Add user mailboxes page of the batch wizard in Step 5.EmailAddress,UserName,Password alex@contoso.com,alex@contoso.com,SourcePassword1 sam@contoso.com,sam@contoso.com,SourcePassword2 info@contoso.com,info@contoso.com,SourcePassword3You should see: The file opens in Notepad with EmailAddress,UserName,Password on line one and one mailbox per line below it. - 2
Protect the file
Where: An encrypted folder or drive on your admin PCThe CSV contains live passwords. Store it encrypted, do not email it, delete it after the migration and reset passwords on the old host when you are done.
You should see: Only the migration admin can open the file, and a reminder to delete it is in your cutover runsheet. - 3
Split into batches
Where: Your mailbox inventory spreadsheet, then separate CSV filesYou do not have to migrate everyone at once. Save a pilot CSV with two or three mailboxes (for example
imap-pilot.csv), then one or more CSVs for the rest. Keep the same header row in every file.You should see: A pilot CSV and a CSV for the remaining users, each with the same three headings.
5Create the IMAP migration endpoint3 steps
- 1
Create the endpoint in the Exchange admin center
Where: Exchange admin center (admin.exchange.microsoft.com) > Migration > Endpoints (top right) > AddOn the Add Endpoint page choose IMAP. Enter a Migration endpoint name (for example
HostIMAP) and in IMAP server type the server from Step 2. Leave the other settings at their defaults, which Microsoft says work in most cases, and select Create. Full detail: create a migration endpoint.You should see: The new endpoint appears in the Endpoints list. If creation fails, the server name, port or security is wrong, or the host blocks the connection. - 2
Or create the endpoint in Exchange Online PowerShell
Where: PowerShell on your admin PC, connected with Connect-ExchangeOnlineIf the module is not installed yet, follow connect to Exchange Online PowerShell. Run the commands with your server name. The default port is 993; valid security values are None, Ssl and Tls.
Connect-ExchangeOnline -UserPrincipalName admin@contoso.com New-MigrationEndpoint -IMAP -Name HostIMAP -RemoteServer mail.contoso-host.com -Port 993 -Security SslYou should see: PowerShell returns the endpoint with EndpointType IMAP and your RemoteServer. - 3
Check the endpoint
Where: The same PowerShell sessionConfirm it was created and note its name for the batch.
Get-MigrationEndpoint | Format-List Identity,EndpointType,RemoteServer,PortYou should see: A list entry with Identity HostIMAP, EndpointType IMAP, your server name and Port 993.
6Create and run the IMAP migration batch4 steps
- 1
Create the batch in the Exchange admin center
Where: Exchange admin center (admin.exchange.microsoft.com) > Migration > Add migration batchType a batch name with no spaces or special characters (for example
IMAPPilot), choose Migrate to Exchange Online and select Next. Select IMAP migration, Next, confirm the prerequisites page and select Next. On Set a migration endpoint pickHostIMAP. On Add user mailboxes select Import CSV file and upload the pilot CSV. On Select configuration settings, use Migration filtering options to exclude folders such as Junk or Trash if you wish. On Schedule batch migration choose to start the batch automatically, then select Save and Done. Full detail: create a migration batch.You should see: The batch appears on the Migration page with status Syncing. - 2
Or create it in PowerShell
Where: PowerShell on your admin PC, connected with Connect-ExchangeOnlineThe CSV is read in as bytes. The batch starts straight away with
-AutoStart.New-MigrationBatch -Name IMAPPilot -SourceEndpoint HostIMAP -CSVData ([System.IO.File]::ReadAllBytes("C:\migration\imap-pilot.csv")) -AutoStartYou should see: PowerShell returns the batch with its Identity and a status of Syncing or Starting. - 3
Monitor progress
Where: Exchange admin center > Migration > select the batch > Migration details > View details, or the same PowerShell sessionCheck per-user status and errors. If a user fails, check the mailbox status report and that the EmailAddress column holds the correct Microsoft 365 address.
Get-MigrationUser -BatchId IMAPPilot | Get-MigrationUserStatistics | Format-Table Identity,Status,SyncedItemCount,ErrorYou should see: The batch reaches Synced, each user shows a SyncedItemCount, and the Error column is empty. - 4
Check the pilot
Where: Outlook on the web (https://outlook.office.com), signed in as each pilot userAsk pilot users to sign in, set their time zone if prompted, and compare folders and recent messages with the old webmail. Then repeat the batch steps above with the CSV for everyone else.
You should see: The same folders and recent messages as on the old host, and all remaining batches at Synced.
7Move contacts and calendars separately3 steps
| Item | Moved by IMAP migration? | How to move it |
|---|---|---|
| Email in inbox and folders | Yes | IMAP batch |
| Contacts | No | Export from the old webmail or client as CSV or vCard, import in Outlook |
| Calendars | No | Export as .ics, import into the Outlook calendar |
| Tasks and notes | No | Recreate, or use a third-party tool |
| Rules, signatures, forwarding | No | Recreate in Outlook |
| Messages over 35 MB | No | Save attachments manually |
- 1
Export contacts and calendars from the old host
Where: The old host's webmail, signed in as each user (Roundcube on cPanel; Zoho Mail Contacts and Zoho Calendar)Have users or IT export before the old service closes:
- Roundcube: in Contacts select the address book and use Export (vCard); in Calendar open the calendar options and export (.ics). Labels vary by Roundcube version.
- Zoho Mail: open the Contacts app, select More Actions > Export, choose Personal Contacts, pick Outlook CSV and select Export Contacts. In Zoho Calendar go to Settings > Import/Export > Export, pick the calendar, choose ICS and select Export.
- Other hosts: use the provider's own export help.
You should see: A contacts file (.csv or .vcf) and an .ics calendar file for each user on your computer. - 2
Import calendars into Outlook
Where: Outlook on the web (https://outlook.office.com) > Calendar > Add calendar > Upload from fileSelect Browse, choose the .ics file, pick the calendar to import into and select Import.
You should see: The events appear in the chosen calendar. Microsoft notes they do not update if the source changes later. - 3
Import contacts into Outlook
Where: Outlook on the web or new Outlook for Windows > PeopleSelect Import contacts, then Browse, choose the CSV file, select Open and then Import. Microsoft's steps use a CSV file and say Outlook needs the column headings in the first row, so do not change them. If you only have a .vcf file, open it in a desktop mail client that reads vCard and export the contacts to CSV first.
You should see: The contacts are listed on the user's People page.
8Change MX and finish4 steps
- 1
Point MX to Microsoft 365
Where: Microsoft 365 admin center > Settings > Domains > your domain > DNS records (to copy values), then your DNS host's control panel > DNS recordsCopy the MX Points to address (it ends in
mail.protection.outlook.com) and the Autodiscover CNAME exactly as the admin center shows them. At your DNS host add the new MX record with priority 1 (or the value shown), add the Autodiscover CNAME, then delete the old host's MX records. Edit the existing SPF TXT record rather than adding a second one, for examplev=spf1 include:spf.protection.outlook.com -all. Full detail: change MX records and set up SPF.nslookup -type=mx contoso.com 8.8.8.8 nslookup -type=txt contoso.com 8.8.8.8You should see: Lookups return only the Microsoft MX value, and the domain shows no missing records on the Domains page. - 2
Wait at least 72 hours
Where: Exchange admin center > Migration > select the batch > View detailsMicrosoft says it can take up to 72 hours for other mail systems to recognise the new MX record, and the batch syncs about once a day. Let the batch keep running for at least 72 hours before you delete it, and check that at least one sync has completed after the MX change.
You should see: The batch still shows Synced, with a last-synced time after the MX change. - 3
Delete the batch
Where: Exchange admin center > Migration > select the batch > Delete, or PowerShell connected with Connect-ExchangeOnlineOnce mail is arriving in Microsoft 365, delete the batch. After deletion, mail that reaches the old host is no longer copied.
Remove-MigrationBatch -Identity IMAPPilotYou should see: The batch is no longer listed on the Migration page. - 4
Keep the old service briefly
Where: Your old host's control panel and billing pageKeep the old host active for a short period so you can recover anything missed, then cancel it and remove its remaining DNS records. Reset or delete the passwords you used in the CSV and delete the CSV.
You should see: No new mail arrives at the old host, and the old service is cancelled on the date in your runsheet.
What can go wrong, and how do you avoid it?
The detail behind the plan: options compared, and what experienced engineers check first. Tap any item.
Compare all the ways to do this3 options
IMAP migration batch in Exchange Online
Medium effortBest for: Any IMAP host reachable from the internet, where you can supply each mailbox password
- Built into Exchange Online and run from the Exchange admin center or PowerShell
- Keeps syncing new mail about once a day until you delete the batch
- One CSV can hold up to 50,000 rows
- Microsoft states it does not move contacts, calendar items or tasks
- Limits of 500,000 items per mailbox and 35 MB per message
- Needs each source password, which usually means a planned reset
PST export and import
High effortBest for: Oversized or problem mailboxes, hosts that block migration connections, or data already held in Outlook
- Does not depend on the host accepting Microsoft's IMAP connection
- Calendars and contacts in the Outlook profile come across in the same file
- A one-off copy with no ongoing sync
- Needs Outlook on a PC for each export and careful handling of the files
Third-party mailbox migration service
Medium effortBest for: Hosts where native IMAP migration falls short, or projects that need vendor support
- Options such as BitTitan MigrationWiz and CodeTwo are built for moves into Microsoft 365
- Can take on mailboxes the native batch struggles with
- Extra product and licences: check the vendor's current pricing
- Confirm the vendor supports your source host and data types first
Start with the native IMAP batch: it costs nothing extra and keeps syncing until cutover. Use PST for the few mailboxes that break the limits, and bring in a third-party service only if a pilot shows the host cannot handle the native migration. If the source is Google Workspace or Exchange, use the dedicated guides instead, because those tools also move calendars and contacts.
Trim what you copy before the first batchSaves time
Microsoft's IMAP migration copies up to 500,000 items per mailbox, newest first, and skips messages over 35 MB. Old Junk, Trash and huge sent-items folders cost sync time on every pass and still fail the size limit.
Ask users to empty Trash and Junk on the old host. In the batch wizard, use Migration filtering options to exclude those folders. For mailboxes near the item limit, export older mail to PST and import it into the archive instead.
Microsoft's IMAP batch has no date filter: it copies every item it can, newest first, up to the 500,000-item cap. CodeTwo Office 365 Migration and MigrationWiz can also filter by item date, so you can move recent mail first and bring older mail across in a later pass, or leave it behind. Both still read the mailbox over IMAP, so they move mail only.
- CodeTwo Office 365 MigrationIMAP source with a time filter that excludes items older or newer than a set date, folder filters and delta passes for new mail.
- MigrationWizAdvanced Options set the earliest and latest date to migrate, plus RegEx folder filters. For Exchange Online, add your MigrationWiz app ID to the tenant's EWS allow list first: since 1 October 2026 Microsoft blocks EWS for apps not on it.
Turn shared logins into shared mailboxes, not licensed usersCost lever
Small hosts often have info@, sales@ and accounts@ as separate logins that several people share. Licensing each one adds cost and keeps a shared password in circulation.
Mark each shared address in your inventory and create it under Teams & groups > Shared mailboxes, with members added. Shared mailboxes do not need a licence. Point the CSV row's EmailAddress at the shared mailbox.
Plan the password reset and tell users firstUser impact
IMAP migration signs in as each user, so you usually reset old-host passwords. Users whose phones still use the old password get repeated sign-in prompts or lock themselves out.
Send the change notice before you reset. Reset all passwords in one sitting, record them only in the encrypted CSV, and reset them again after the batch is deleted. Microsoft supports admin credentials only on servers set up for it (for example a Dovecot master user), which shared hosting rarely offers.
Work within the host's connection limitsSaves time
Microsoft notes that source limits on connections per user, per IP or in total slow IMAP migrations. Shared hosting often has tight limits, and a big batch can be throttled or flagged as abuse.
Ask the host for its IMAP limits before you start. Run several small batches rather than one large one, and start the big ones outside business hours.
Once started, Microsoft's IMAP batch runs until it finishes. CodeTwo Office 365 Migration lets you set how many mailboxes migrate at once, has a throttling step in its IMAP source settings for servers that throttle connections, and has a Scheduler that runs jobs only in the time periods you choose, such as overnight.
- CodeTwo Office 365 MigrationSets mailboxes migrated at once, adjusts to IMAP servers that throttle, and schedules jobs into chosen time windows.
Export contacts and calendars while the old service is openUser impact
IMAP migration moves mail folders only. Contacts, calendars and tasks stay behind, and they are lost when the hosting account is cancelled.
Add a contacts and calendar export per user to your runsheet before cutover, and keep the files with the migration records. Recurring meetings imported from .ics do not update if the organiser changes them later, so ask organisers to resend important series from Outlook.
The native import copies mail only. audriga also migrates contacts and calendars into Microsoft 365, reading them from the old host over CardDAV and CalDAV or from supported webmail such as Roundcube. It only works where the old host exposes that data, so test one account first.
- audrigaMigration service for email, contacts and calendars from IMAP servers, CardDAV and CalDAV systems and Horde, Roundcube or SquirrelMail webmail. Microsoft 365 and Google Workspace are among its supported systems.
Find everything else that sends mail for the domainReduces risk
Website forms, invoicing tools, scanners and printers often send through the old host. After cutover they fail SPF or keep delivering into the old mailboxes.
List every sender in your inventory. Add each legitimate service to the single SPF record, and repoint devices that relayed through the old host's SMTP server to Microsoft 365 or the service's own relay.
Expect Outlook and phones to start againPerformance
An IMAP account in Outlook or on a phone cannot be converted to a Microsoft 365 account. The new account downloads the whole mailbox again, which loads slow office links.
Book the device changeover for the day after MX moves, in small groups. Remove the old IMAP account, add the Microsoft 365 account, and leave PCs on overnight to finish the first download.
Keep a rollback path until the batch is deletedReduces risk
Until you delete the batch, the old host still holds a full copy and keeps receiving mail from senders with a cached MX. Microsoft says other systems can take up to 72 hours to see the new MX.
Lower the MX TTL first, keep your saved DNS records, and do not cancel the old service until 72 hours after the MX change and a final check of each mailbox. Take a last export of the old mailboxes for your records before cancelling.
How do you check it worked, or roll back?
Full validation checklist8 checks
Run these before you declare the migration complete. Record the results in the data validation report.
| Check | How to check | What good looks like |
|---|---|---|
| Every migration user synced without errors | For each batch run | Every mailbox in your inventory is Synced with an empty Error column. |
| Item counts and folders match the old mailbox | Compare SyncedItemCount with the message counts or mailbox sizes your old host shows, then sign in to Outlook on the web as a sample of users and compare folders and recent mail with the old webmail. | All folders are present, and missing items are only ones you expected (over the 35 MB message limit, beyond 500,000 items, or deliberately excluded). |
| Shared mailboxes and their members work | From an outside account, send a test to each shared mailbox. Ask each member to open it from Outlook and check Microsoft 365 admin center > Teams & groups > Shared mailboxes for the member list. | Every shared address receives mail and every intended member can open and send from it. |
| DNS records are healthy | In the Microsoft 365 admin center open Settings > Domains > your domain > DNS records, and run | MX ends in mail.protection.outlook.com, Autodiscover is present, there is one SPF record including spf.protection.outlook.com, and the admin center shows no errors. |
| Mail flows in and out | Send test messages from outside providers to a sample of users and reply. Trace them in Exchange admin center > Mail flow > Message trace, and check the headers of a reply at the outside mailbox for SPF, DKIM and DMARC results. | Inbound mail arrives within minutes, and replies pass SPF, DKIM and DMARC. |
| Contacts and calendars imported | Open Outlook on the web as a sample of users and check Calendar and People against the exports from the old host. | Upcoming events and contacts are present for every user who had them. |
| Outlook and phones connect to Microsoft 365 | Ask each user to confirm their Outlook profile and phone use the Microsoft 365 account and the old IMAP account has been removed. | Every user sends and receives on desktop and phone, and no device still sends through the old host. |
| The old host has stopped receiving mail | After at least 72 hours, sign in to the old webmail as a sample of users and check the newest message dates before you delete the batch. | No new message reaches the old host after the MX change. |
Rollback planIf it goes wrong
Roll back if
- Outside mail is not arriving in Microsoft 365 after the MX change
- The pilot batch fails for most mailboxes and the host cannot raise connection limits or fix the cause before cutover
- Large numbers of folders or messages are missing when you compare Outlook on the web with the old webmail
- Users cannot sign in to Microsoft 365 on cutover day
Point of no return
The IMAP batch copies mail and leaves the source untouched, so you can switch back while the old service is active. After you delete the batch, nothing reaching the old host is copied any more. The real point of no return is cancelling the old host, because its mailboxes are then removed on the host's schedule. Microsoft has no tool to copy mail from Microsoft 365 back to an IMAP server, so mail received in Microsoft 365 after the MX change has to be moved by hand.
- 1
Restore the old MX record
Where: Your DNS host's control panel > DNS recordsAdd back the old MX record from your DNS cutover record sheet and delete the record ending in mail.protection.outlook.com. Remove the Autodiscover CNAME if the old host relied on its own autoconfig records.
nslookup -type=mx contoso.com 8.8.8.8You should see: Public resolvers return the old MX record. - 2
Restore SPF for the old host
Where: Your DNS host > DNS records > the v=spf1 TXT record > EditMake sure the single SPF record includes the old host again. You can leave Microsoft 365 in it while you decide on a retry.
You should see: Mail sent from the old host passes SPF at an outside mailbox. - 3
Stop the batch
Where: Exchange admin center > Migration > select the batch, or Exchange Online PowerShellStop the batch so it stops syncing, but keep the Microsoft 365 mailboxes for a later attempt.
Stop-MigrationBatch -Identity IMAPPilotYou should see: The batch shows as stopped. - 4
Reconnect users to the old host
Where: Each user's Outlook profile and phone, or the old webmailRe-add the old IMAP account or tell users to use the old webmail, and give them the password you set for the migration if you changed it.
You should see: Users send and receive from the old mailboxes. - 5
Move back mail received in Microsoft 365
Where: Classic Outlook with both the Microsoft 365 and old IMAP accounts addedFor each affected user, drag messages that arrived in Microsoft 365 after the MX change into the old IMAP inbox.
You should see: Messages from the cutover window appear in the old webmail.
Agree the triggers and who decides before the go / no-go meeting. Use the rollback plan template.
Common problems and fixes6 errors
Authentication failed for a user in the IMAP batchCause: Wrong password in the CSV, the account needs an app password, or IMAP is disabled for the account on the old host.
Fix: Check the sign-in in a desktop mail client, enable IMAP, use an app password if required, then update the CSV and retry.
The IMAP server could not be reached when creating the endpointCause: Wrong server name, port or security setting, or the host blocks the connection.
Fix: Confirm the IMAP server name and port with your host, test with -Security Ssl on port 993, and ask the host about firewall or geo-blocking.
Mailbox does not exist for a CSV rowCause: The EmailAddress column points to an address with no Exchange Online mailbox.
Fix: Create and license the user first, or fix the address in the CSV.
Some items skipped or missingCause: Messages over 35 MB, or mailboxes with more than 500,000 items, exceed Microsoft's IMAP limits.
Fix: Save large attachments manually. For very large mailboxes, archive older mail separately, for example as PST.
Migration is very slowCause: The source host limits concurrent IMAP connections.
Fix: Ask the host to raise connection limits, migrate in smaller batches, or run batches outside business hours.
CSV upload rejectedCause: Column headings are wrong or contain spaces.
Fix: Use exactly EmailAddress, UserName and Password in the first row.
Frequently asked questions
Does IMAP migration move contacts and calendars?
No. Microsoft states IMAP migration only moves items in the inbox and other mail folders. Export and import contacts and calendars separately.
How many mailboxes can I migrate with IMAP?
A single migration CSV can include up to 50,000 mailboxes and be up to 10 MB. Run several batches if you prefer.
What is the largest email IMAP migration can move?
Microsoft lists a 35 MB maximum message size and up to 500,000 items per mailbox, migrated newest to oldest.
Do I need users' passwords?
Usually yes, unless your host supports admin access over IMAP. Reset or collect passwords, and reset them again after the migration.
When should I change the MX record?
After the first sync completes. Keep the batch running for at least 72 hours after the change, then delete it.
Can I migrate from Gmail with IMAP?
You can, but for Google Workspace Microsoft provides a dedicated migration that also moves calendars and contacts. See the Google Workspace guide.
Official sources
11 official pages this guide is based on
Vendors change limits and features, so confirm details on the source before you rely on them. Last checked 4 Nov 2026.