
Corporate Mail, Part 6: Moving Between Systems — imapsync, built-in wizards, and MX switching checklist
🌐 Machine-translated from Russian. Show original
In this part:
What we carry#
| Data | What is carried over |
|---|---|
| Emails and folders | IMAP synchronization (imapsync, cloud wizards) |
| Calendars | export/import ICS, CalDAV, Microsoft/Google wizards for "your" systems |
| Contacts | export/import vCard/CSV, CardDAV, |
| Shared mailboxes, distribution groups, | are created again manually or by scripting |
| Rules, signatures, delegation, | anew, according to the |
| Pseudonym addresses | renewed after exporting from the old system |
Important: IMAP transfers only mail. Calendars and contacts need to be transferred separately — set aside time for this.
Tools#
| Tool | From → Where to | Features |
|---|---|---|
| IMAP migration to Microsoft 365 (Exchange admin center → Migration) | any IMAP → Microsoft 365 | emails only; up to 500,000 items per mailbox; email up to 35 MB; CSV with mailbox list |
| Hybrid migration Exchange | Exchange SE → Microsoft 365 | migrates everything, including calendars; Outlook does not need to be reconfigured |
| Google Workspace (Data Migration) Migration Wizard | Microsoft 365, Exchange, IMAP, → Workspace | mail, and for some sources — calendars and contacts |
| imapsync | any IMAP → any IMAP | a universal, multi-run start, transfers only the missing |
| Synchronization in Mailcow (Sync jobs) | external IMAP → Mailcow | built-in IMAPSYNC with configuration from the web panel |
imapsync#
The most versatile tool: copies folders and emails from server to server, and only downloads new ones when restarted. Source code is available, the official build is distributed by the author (who also has the FAQ on Gmail, Office 365, and OAuth2). For one-time ports of small volume, the author has an online service.
Example for a single drawer (do not write passwords in the command line — use files with 600 permissions):
imapsync \
--host1 old-mail.company.kz --user1 ivanov@company.kz --passfile1 /root/secrets/ivanov.old \
--host2 mail.company.kz --user2 ivanov@company.kz --passfile2 /root/secrets/ivanov.new \
--automap --addheader \
--exclude "^Junk|^Spam"
--automap— maps system folders (Sent/Sent, Trash) between servers;--dry— trial run without copying: start with it;- for Gmail and Microsoft 365, signing in with a regular password is often prohibited — OAuth2 or an app password is required; see the FAQ on the imapsync website.
After transferring, delete the password files. If you do not know user passwords — use administrator access (master user in Dovecot, delegation in Exchange) instead of resetting passwords for everyone.
Relocation plan#
In 2 weeks#
- Inventory: list of drawers, sizes, shared drawers, groups, aliases, transfers. Delete dismissed drawers (or move them to the archive by manager's decision).
- All senders from the domain: website, 1C, CRM, scanners, mailings — they will need new SMTP settings and SPF entries.
- Lower the TTL of MX and autodiscover records to 300 seconds — at least two days before switching (so the old TTL can expire).
- Create mailboxes in the new system, verify the domain (without changing MX).
- Pilot: 2–3 IT employees, then 5–10 "regular" users.
In a week#
- The first synchronization of all drawers is the longest, taking a day or more. Do it at night and on weekends.
- Prepare instructions for employees: how to log in, set up a phone number, where to find old emails, and where to write in case of problems.
- Transfer calendars and contacts, create shared mailboxes and groups.
Switching day (preferably Friday evening)#
- Resynchronization (delta) — fast, only new.
- Switch MX to the new system, update SPF (temporarily — both services), autodiscover, MTA-STS (policy first, then MX).
- Check inbound and sending: in, out, from Gmail and Outlook.com, reply to an old email.
- Reconfigure 1C, website, scanners, CRM.
After switching#
- Another 1–2 synchronizations during the week: some emails via the DNS cache may still arrive on the old server.
- Enable DKIM in the new system, remove old
includefrom SPF, check DMARC reports. - Keep the old system in read-only mode for 30–90 days, then make a final backup and turn it off.
- Return the TTL to normal values (3600 and above).
Common problems#
| The problem | Cause and solution |
|---|---|
| Emails arrive alternately in the old and new systems | the DNS cache; therefore, TTL is lowered in advance and delta synchronization is performed after |
| Outlook continues to visit the old server | Autodiscover points to the old server or settings are cached in the profile — create a new Outlook profile |
| Missing emails | source limits (number of connections), large emails (35 MB in M365), excluded folders; compare the number of emails by folders |
| Duplicate emails | synchronization were run with different tools; use one tool for all passes |
| Emails from the website or 1C in spam | the new service is not added to SPF/DKIM |
| Calendars have not migrated | IMAP does not migrate them — a separate export |
Move checklist#
- Inventory of mailboxes, groups, aliases, forwards, and all senders from the domain
- TTL MX and autodiscover reduced to 300 in two days
- Pilot completed with 5–10 users
- The first full synchronization is complete, the number of emails across folders matches
- Calendars, contacts, shared mailboxes, and groups migrated
- Employee instructions and support contact have been sent out
- MX, SPF, autodiscover, MTA-STS switched; arrival and dispatch checked externally
- 1C, website, CRM, scanners reconfigured
- Delta syncs throughout the week
- DKIM and DMARC in the new system, unnecessary include removed from SPF
- Old system — read-only 30–90 days, final backup, shutdown
Series Summary#
| Part | What can you do |
|---|---|
| 1 | select mail for tasks, budget, and data storage requirements |
| 2 | set up DNS so that emails reach and your email cannot be spoofed |
| 3 | to launch Microsoft 365 with AD and MFA sync |
| 4 | to raise and maintain your server on Mailcow |
| 5 | protect your email from phishing and hacking, set up an archive and backup |
| 6 | to move between systems without losing emails |
🎉 Series completed. Return to contents.
💬 Which system did you switch from, and what went wrong? Share in the comments — we'll add to the checklist.
Comments · 0
No comments yet.Sign in to comment, rate and see all comments.