Migrating 100,000+ mailboxes from Google Workspace without dropping a single email
How we engineered a streaming IMAP synchronization pipeline that preserves message hierarchies, migrates attachments in parallel, and verifies DNS cutover without duplicate UID propagation.

Continuous delta polling active • Zero UID collisions detected
Email migration is universally feared by IT teams. When a 50-person startup switches email providers, they dread lost threads, altered timestamps, and hours of DNS uncertainty during cutover. Here is how we engineered Kosh's zero-downtime migration engine.
The Challenge with Legacy IMAP Sync
Standard IMAP tools crawl folders sequentially: fetch message headers, download RFC-822 bodies, and append them to the target server. For mailboxes containing 100,000+ emails and gigabytes of attachments, sequential sync takes days and frequently trips Gmail API rate limits.
Furthermore, if an email arrives during migration, traditional scripts either duplicate the message or drop it altogether.
Parallel Chunked Streaming Architecture
Kosh approaches synchronization as a continuous log replication problem. We divide mailboxes into deterministic time slices and execute parallel streaming pipelines across isolated worker threads.
Once the historical archive is transferred, Kosh enters a high-frequency polling phase. When you update your MX records, remaining incoming delta emails are merged seamlessly.
{
"source_provider": "google_workspace",
"mailbox": "team@startup.com",
"batch_size": 500,
"concurrency": 8,
"preserve_flags": ["\Seen", "\Flagged", "\Draft"],
"deduplication_mode": "message_id_hash"
}Zero-Downtime DNS Verification
During final MX cutover, our edge edge-routers accept connections for your domain while your previous records propagate. Messages sent to either your old or new MX server are captured and deduplicated in real time.
- Continuous synchronization with sub-second message deduplication
- Automatic flag and label preservation (Starred, Archive, Sent, Custom Folders)
- Instant fallback if Google or Microsoft throttles IMAP connection limits
Key Takeaway
Switching from legacy suites to a private custom-domain setup shouldn't require a weekend of panic. With deterministic streaming, moving your entire organization's communication history takes just a few clicks.

Parminder Singh
AuthorFounder & Architect, Kosh
Building private, transparent email infrastructure for modern teams and creators.
Read next
Email Deliverability PSA: 1024-bit DKIM keys are being flagged by major inboxes
Google, Yahoo, and Microsoft have tightened sender authentication thresholds. Domains still signing with legacy 1024-bit RSA keys are experiencing degraded spam scores. Here is what changed and how Kosh automatically deploys rotating 2048-bit DKIM keys.
Read articleApr 14, 2026 • 5 min readThe hidden tax of per-seat email: Why team communication shouldn't scale linearly with head count
Legacy enterprise suites penalize fast-growing startups by charging $7 to $18 per month for every single inbox, contractor, or shared alias. We break down the actual infrastructure cost of operating high-reputation mail systems.
Read articleReady to get started?
Join thousands of users who are already building the future with Kosh.