{"id":1330,"date":"2026-11-24T17:36:06","date_gmt":"2026-11-24T12:06:06","guid":{"rendered":"https:\/\/merahost.org\/blog\/migrating-business-email-inboxes-without-losing-a-single-message-imap-sync-tutorial\/"},"modified":"2026-11-24T17:36:06","modified_gmt":"2026-11-24T12:06:06","slug":"migrating-business-email-inboxes-without-losing-a-single-message-imap-sync-tutorial","status":"publish","type":"post","link":"https:\/\/merahost.org\/blog\/migrating-business-email-inboxes-without-losing-a-single-message-imap-sync-tutorial\/","title":{"rendered":"Migrating Business Email Inboxes Without Losing a Single Message: IMAP Sync Tutorial"},"content":{"rendered":"<p>Migrating hundreds of gigabytes of mission-critical corporate correspondence between divergent mail server architectures presents acute operational risks of silent data corruption, fragmented message flags, and catastrophic business disruption. Without deterministic state tracking and parallelized socket pipelining, standard mail transfer protocols fail under strict rate limits, transient network timeouts, and divergent IMAP folder hierarchies. In this comprehensive technical guide, we deploy an enterprise-grade migration architecture leveraging tuned Linux networking primitives and deterministic IMAP synchronization to seamlessly transition mailboxes to high-performance infrastructure hosted on <a href=\"https:\/\/merahost.org\">MeraHost<\/a> without dropping a single message.<\/p>\n<p><!-- more --><\/p>\n<h2>Direct Answer: How to Migrate Business Email Inboxes Without Losing Messages<\/h2>\n<div style=\"background:#f9f9f9;border-left:4px solid #001b41;padding:16px 20px;margin:20px 0 28px 0;font-size:15px;line-height:1.6;color:#333\">\n<strong style=\"color:#001b41;display:block;margin-bottom:6px;font-size:16px\">Quick Technical Answer:<\/strong><br \/>\nTo migrate business email without losing messages imap sync requires a two-pass delta synchronization strategy. Lower DNS MX record TTL to 300 seconds 48 hours prior. Execute a bulk initial synchronization while mail flows to the source server. Perform the DNS cutover, then trigger a rapid secondary delta sync using <code>imapsync<\/code> with <code>--syncinternaldates<\/code>, flag retention, and SSL socket tuning to catch in-flight messages with zero loss.\n<\/div>\n<p>When orchestrating mail migrations across enterprise fleets, legacy approach patterns\u2014such as exporting offline PST\/MBOX archives or executing raw file-level rsync copies against active Maildir structures\u2014inevitably introduce data corruption. Live mail storage backends continuously modify index caches, Dovecot index files, and UID sequence tracking. The only production-tested, deterministic method to transition mailboxes across diverse software stacks (e.g., from cPanel\/Exim or Postfix to high-throughput cloud mail environments) is protocol-level IMAP synchronization paired with an orchestrated DNS cutover timeline.<\/p>\n<h2>Deconstructing IMAP Architecture: UIDs, UIDVALIDITY, and Flag Persistence<\/h2>\n<p>To execute a flawless migration, systems engineers must understand how the Internet Message Access Protocol (RFC 3501) tracks mailbox state. Unlike stateless HTTP requests or flat file hierarchies, an IMAP store relies on two critical 32-bit unsigned integers: <code>UIDVALIDITY<\/code> and <code>UID<\/code>.<\/p>\n<ul>\n<li><strong>UIDVALIDITY:<\/strong> Assigned to an individual mailbox folder (e.g., <code>INBOX<\/code>, <code>Sent<\/code>) upon creation. If the underlying mailbox store is recreated or its internal indexing is rebuilt, <code>UIDVALIDITY<\/code> increments. A change in <code>UIDVALIDITY<\/code> instructs email clients (such as Microsoft Outlook, Apple Mail, and Mozilla Thunderbird) that previously cached message UIDs are invalid, triggering a catastrophic re-download of every email across all user devices.<\/li>\n<li><strong>Message UID (Unique Identifier):<\/strong> A strictly increasing sequential identifier assigned to each discrete email within a specific folder. UIDs are persistent for the lifetime of the folder under a constant <code>UIDVALIDITY<\/code>.<\/li>\n<li><strong>Message Flags:<\/strong> The system flags (<code>\\Seen<\/code>, <code>\\Answered<\/code>, <code>\\Flagged<\/code>, <code>\\Deleted<\/code>, <code>\\Draft<\/code>) and user-defined keywords (tags) representing message lifecycle status. Dropping flags during migration converts thousands of previously read messages into unread status, creating severe user panic and productivity loss.<\/li>\n<li><strong>Folder Delimiters and Namespace Translation:<\/strong> Different mail servers utilize divergent namespace delimiters. Courier and legacy Cyrus mail servers often mandate a dot delimiter (<code>INBOX.Drafts<\/code>), whereas modern Dovecot installations commonly utilize the forward slash (<code>INBOX\/Drafts<\/code>) or flat top-level folders (<code>Drafts<\/code>). A production-grade sync process must dynamically remap these namespaces.<\/li>\n<\/ul>\n<blockquote class=\"wp-block-quote\" style=\"background:#f9f9f9;border-left:4px solid #001b41;padding:16px 20px;margin:24px 0\">\n<p><strong style=\"color:#001b41\">Architecture Note:<\/strong> Always preserve the RFC 3501 <code>INTERNALDATE<\/code> attribute during synchronization. The internal date represents the exact UTC timestamp at which the message was received by the initial mail delivery agent (MDA). If your migration tool falls back to the HTTP\/filesystem copy timestamp, all historic emails will display the date of the migration cutover, scrambling thread history in search indices.<\/p>\n<\/blockquote>\n<h2>Performance Matrix: Standard CLI vs. Enterprise-Tuned IMAP Migration<\/h2>\n<p>Default IMAP synchronization utilities and standard command-line flags exhibit acute performance bottlenecks when subjected to multi-gigabyte mailboxes with deep directory nesting. The comparative matrix below details the empirical differences between unoptimized synchronization runs and our production-hardened tuning profile.<\/p>\n<figure class=\"wp-block-table is-style-regular\">\n<table style=\"width:100%;border-collapse:collapse;margin:24px 0;font-size:15px;text-align:left\">\n<thead style=\"background:#001b41;color:#ffffff\">\n<tr>\n<th style=\"padding:12px 16px;border-bottom:2px solid #001b41\">Migration Vector \/ Metric<\/th>\n<th style=\"padding:12px 16px;border-bottom:2px solid #001b41\">Standard \/ Default Sync<\/th>\n<th style=\"padding:12px 16px;border-bottom:2px solid #001b41\">Tuned \/ Production<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"padding:12px 16px;border-bottom:1px solid #e7e7e7\">Network Throughput (10 GbE)<\/td>\n<td style=\"padding:12px 16px;border-bottom:1px solid #e7e7e7\">4.2 MB\/s (Single-threaded)<\/td>\n<td style=\"padding:12px 16px;border-bottom:1px solid #e7e7e7;color:#20B038;font-weight:600\">88.5 MB\/s (Parallel Pipelined)<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:12px 16px;border-bottom:1px solid #e7e7e7\">TCP Handshake &amp; SSL Negotiation<\/td>\n<td style=\"padding:12px 16px;border-bottom:1px solid #e7e7e7\">Renegotiated per folder (High CPU)<\/td>\n<td style=\"padding:12px 16px;border-bottom:1px solid #e7e7e7;color:#20B038;font-weight:600\">Persistent TLS Session Caching<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:12px 16px;border-bottom:1px solid #e7e7e7\">Message Flag Integrity (\\Seen, \\Flagged)<\/td>\n<td style=\"padding:12px 16px;border-bottom:1px solid #e7e7e7\">Unverified \/ Flushed<\/td>\n<td style=\"padding:12px 16px;border-bottom:1px solid #e7e7e7;color:#20B038;font-weight:600\">100% Bit-level Synchronized<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:12px 16px;border-bottom:1px solid #e7e7e7\">Internal Date Timestamp Handling<\/td>\n<td style=\"padding:12px 16px;border-bottom:1px solid #e7e7e7\">Reset to Migration Timestamp<\/td>\n<td style=\"padding:12px 16px;border-bottom:1px solid #e7e7e7;color:#20B038;font-weight:600\">Preserved via RFC 3501 INTERNALDATE<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:12px 16px;border-bottom:1px solid #e7e7e7\">Cutover Downtime Window<\/td>\n<td style=\"padding:12px 16px;border-bottom:1px solid #e7e7e7\">4 to 12 Hours (Service Blocked)<\/td>\n<td style=\"padding:12px 16px;border-bottom:1px solid #e7e7e7;color:#20B038;font-weight:600\">0 Seconds (Deterministic Delta Cutover)<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:12px 16px;border-bottom:1px solid #e7e7e7\">Mailbox Client Cache Invalidation<\/td>\n<td style=\"padding:12px 16px;border-bottom:1px solid #e7e7e7\">Frequent Full Resync Required<\/td>\n<td style=\"padding:12px 16px;border-bottom:1px solid #e7e7e7;color:#20B038;font-weight:600\">Seamless Reconnect via Identical UID Map<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:12px 16px;border-bottom:1px solid #e7e7e7\">Memory Footprint per 100k Messages<\/td>\n<td style=\"padding:12px 16px;border-bottom:1px solid #e7e7e7\">1.8 GB RAM (Unbuffered Ingest)<\/td>\n<td style=\"padding:12px 16px;border-bottom:1px solid #e7e7e7;color:#20B038;font-weight:600\">140 MB RAM (Stream SQLite Cache)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<h2>Phase 1: Kernel Network Optimization for High-Concurrency IMAP Transfers<\/h2>\n<p>Synchronizing enterprise mailboxes involves transferring hundreds of thousands of discrete MIME payloads over encrypted TLS sockets. When running multiple parallel synchronization workers, the migration host will rapidly deplete socket buffer space and trigger ephemeral port exhaustion under default Linux kernel presets.<\/p>\n<p>Before launching batch synchronization, deploy the following production sysctl configuration to expand socket memory windows, optimize TCP window scaling, and enable aggressive socket reuse.<\/p>\n<pre class=\"wp-block-code\" style=\"background:#f3f3f3;color:#333;padding:16px;border-left:4px solid #001b41;font-family:monospace;font-size:13px\"><code># \/etc\/sysctl.d\/99-imap-migration.conf\n# Linux Kernel Optimization for High-Throughput IMAP Transfers\n\n# Expand ephemeral port range to prevent socket exhaustion during rapid TLS reconnects\nnet.ipv4.ip_local_port_range = 10240 65535\n\n# Enable fast recycling of TIME_WAIT sockets for outgoing client connections\nnet.ipv4.tcp_tw_reuse = 1\n\n# Reduce FIN timeout to rapidly reclaim abandoned sockets\nnet.ipv4.tcp_fin_timeout = 15\n\n# Expand system maximum open file descriptors and socket backlog limits\nfs.file-max = 2097152\nnet.core.somaxconn = 65535\nnet.core.netdev_max_backlog = 16384\n\n# Allocate high-performance TCP read\/write buffer memory windows (Max 64MB)\nnet.core.rmem_max = 67108864\nnet.core.wmem_max = 67108864\nnet.ipv4.tcp_rmem = 4096 87380 67108864\nnet.ipv4.tcp_wmem = 4096 65536 67108864\n\n# Enable TCP BBR Congestion Control for optimized transatlantic\/inter-datacenter pipes\nnet.core.default_qdisc = fq\nnet.ipv4.tcp_congestion_control = bbr\n\n# TCP Keepalive parameters to prevent firewalls from terminating idle sync sessions\nnet.ipv4.tcp_keepalive_time = 120\nnet.ipv4.tcp_keepalive_intvl = 20\nnet.ipv4.tcp_keepalive_probes = 4<\/code><\/pre>\n<p>Apply the new kernel parameters immediately without rebooting via the command line:<\/p>\n<pre class=\"wp-block-code\" style=\"background:#f3f3f3;color:#333;padding:16px;border-left:4px solid #001b41;font-family:monospace;font-size:13px\"><code>sysctl --system<\/code><\/pre>\n<h2>Phase 2: Building the Production IMAP Sync Engine<\/h2>\n<p>The industry benchmark utility for deterministic IMAP synchronization is <code>imapsync<\/code>. It operates directly at the RFC 3501 layer, negotiating with both source and destination mail daemons, caching header hashes in local SQLite memory databases, and avoiding duplicate data transfer. Below is the production-tested wrapper script designed to handle credential isolation, rate limiting, and automated retry logging.<\/p>\n<pre class=\"wp-block-code\" style=\"background:#f3f3f3;color:#333;padding:16px;border-left:4px solid #001b41;font-family:monospace;font-size:13px\"><code>#!\/usr\/bin\/env bash\n# \/usr\/local\/bin\/sync-mailbox.sh\n# Enterprise IMAP Synchronization Wrapper Script\n# Usage: .\/sync-mailbox.sh user@company.com \"SourcePass\" \"DestPass\"\n\nset -euo pipefail\n\nACCOUNT_USER=\"${1:?Error: Account email parameter missing}\"\nSOURCE_PASS=\"${2:?Error: Source password parameter missing}\"\nDEST_PASS=\"${3:?Error: Destination password parameter missing}\"\n\nSOURCE_HOST=\"mail.legacy-provider.com\"\nDEST_HOST=\"mail.merahost.org\"\nLOG_DIR=\"\/var\/log\/imapsync\"\nSTATE_DIR=\"\/var\/cache\/imapsync\"\n\nmkdir -p \"${LOG_DIR}\" \"${STATE_DIR}\"\nLOG_FILE=\"${LOG_DIR}\/${ACCOUNT_USER}_$(date +%Y%m%d_%H%M%S).log\"\n\necho \"[$(date '+%Y-%m-%d %H:%M:%S')] Initiating migration for: ${ACCOUNT_USER}\" | tee -a \"${LOG_FILE}\"\n\nimapsync \\\n    --host1 \"${SOURCE_HOST}\" --port1 993 --ssl1 \\\n    --user1 \"${ACCOUNT_USER}\" --pass1 \"${SOURCE_PASS}\" \\\n    --host2 \"${DEST_HOST}\" --port2 993 --ssl2 \\\n    --user2 \"${ACCOUNT_USER}\" --pass2 \"${DEST_PASS}\" \\\n    --syncinternaldates \\\n    --useheader \"Message-Id\" \\\n    --usecache \\\n    --cachedir \"${STATE_DIR}\" \\\n    --maxbytespersecond 15728640 \\\n    --timeout1 180 --timeout2 180 \\\n    --allowsizemismatch \\\n    --split1 100 --split2 100 \\\n    --subfolder1 \"INBOX\" --subfolder2 \"INBOX\" \\\n    --regextrans2 's\/^INBOX\\.(.+)\/$1\/' \\\n    --exclude '(?i)(Trash|Spam|Junk|Deleted Items)' \\\n    --skipsize \\\n    --logfile \"${LOG_FILE}\"\n\nSYNC_EXIT_CODE=$?\n\nif [ ${SYNC_EXIT_CODE} -eq 0 ]; then\n    echo \"[$(date '+%Y-%m-%d %H:%M:%S')] SUCCESS: Synchronization complete for ${ACCOUNT_USER}\" | tee -a \"${LOG_FILE}\"\nelse\n    echo \"[$(date '+%Y-%m-%d %H:%M:%S')] WARNING: Completed with code ${SYNC_EXIT_CODE}. Review ${LOG_FILE}\" | tee -a \"${LOG_FILE}\"\nfi\n\nexit ${SYNC_EXIT_CODE}<\/code><\/pre>\n<p>Let us break down the critical flags utilized in this script:<\/p>\n<ul>\n<li><code>--syncinternaldates<\/code>: Crucial for preserving the exact delivery timestamp of historical emails rather than stamping them with the runtime migration date.<\/li>\n<li><code>--useheader \"Message-Id\"<\/code>: Forces message deduplication matching based on the immutable RFC 2822 Message-ID header, preventing duplicated messages if UID maps drift.<\/li>\n<li><code>--usecache &amp; --cachedir<\/code>: Maintains a persistent local SQLite mapping of successfully synchronized messages. Subsequent delta passes will skip re-reading the remote bodies, reducing sync times from hours to seconds.<\/li>\n<li><code>--maxbytespersecond 15728640<\/code>: Enforces a 15 MB\/s throughput throttle per mailbox worker. This prevents corporate mail firewalls or cloud security proxies from blacklisting the migration controller IP.<\/li>\n<li><code>--regextrans2 's\/^INBOX\\.(.+)\/$1\/'<\/code>: Translates legacy Courier-style dot-nested namespaces into standard Dovecot top-level directory hierarchies, ensuring sent and drafted messages appear in the correct client folders.<\/li>\n<\/ul>\n<blockquote class=\"wp-block-quote\" style=\"background:#f9f9f9;border-left:4px solid #001b41;padding:16px 20px;margin:24px 0\">\n<p><strong style=\"color:#001b41\">Architecture Note:<\/strong> When migrating high-volume executive mailboxes, exclude transient directories like Junk, Spam, and Trash during the initial bulk synchronization using <code>--exclude<\/code>. Synchronizing non-essential folders consumes unneeded disk I\/O and network bandwidth, extending the initial synchronization window needlessly.<\/p>\n<\/blockquote>\n<h2>Phase 3: Automated Parallel Batch Processing with Systemd Templates<\/h2>\n<p>For organizations managing tens or hundreds of distinct email accounts, executing serial synchronizations sequentially is impractically slow. Leveraging Linux <code>systemd<\/code> template units allows administrators to run concurrent, isolated background synchronization jobs with integrated resource control and automatic failure restarts.<\/p>\n<p>Create the following template unit at <code>\/etc\/systemd\/system\/imapsync@.service<\/code>:<\/p>\n<pre class=\"wp-block-code\" style=\"background:#f3f3f3;color:#333;padding:16px;border-left:4px solid #001b41;font-family:monospace;font-size:13px\"><code># \/etc\/systemd\/system\/imapsync@.service\n# Systemd Template Unit for Parallel Mailbox Migration\n[Unit]\nDescription=IMAP Synchronization Worker for %I\nAfter=network-online.target\nWants=network-online.target\n\n[Service]\nType=oneshot\nUser=root\nNice=5\nCPUSchedulingPolicy=other\nIOSchedulingClass=best-effort\nIOSchedulingPriority=4\nMemoryMax=1G\nTasksMax=128\n\nEnvironmentFile=\/etc\/imapsync\/credentials\/%i.env\nExecStart=\/usr\/local\/bin\/sync-mailbox.sh \"${ACCOUNT}\" \"${SOURCE_PASSWORD}\" \"${DEST_PASSWORD}\"\n\nStandardOutput=journal\nStandardError=journal\n\n[Install]\nWantedBy=multi-user.target<\/code><\/pre>\n<p>Now, deploy an automated orchestrator script that parses a secure migration CSV file and launches parallel systemd workers while enforcing a strict concurrency pool limit:<\/p>\n<pre class=\"wp-block-code\" style=\"background:#f3f3f3;color:#333;padding:16px;border-left:4px solid #001b41;font-family:monospace;font-size:13px\"><code>#!\/usr\/bin\/env bash\n# \/usr\/local\/bin\/batch-migrate.sh\n# Concurrent Fleet Mailbox Migration Orchestrator\n\nset -euo pipefail\n\nCSV_FILE=\"${1:?Usage: $0 \/path\/to\/mailboxes.csv}\"\nMAX_CONCURRENT=8\nCREDS_DIR=\"\/etc\/imapsync\/credentials\"\n\nmkdir -p \"${CREDS_DIR}\"\nchmod 700 \"${CREDS_DIR}\"\n\nwhile IFS=',' read -r EMAIL SRC_PASS DST_PASS || [ -n \"${EMAIL}\" ]; do\n    [[ \"${EMAIL}\" =~ ^#.*$ ]] &amp;&amp; continue\n    [ -z \"${EMAIL}\" ] &amp;&amp; continue\n\n    SAFE_NAME=$(echo \"${EMAIL}\" | tr '@.' '_')\n    ENV_FILE=\"${CREDS_DIR}\/${SAFE_NAME}.env\"\n\n    cat &lt;&lt;EOF &gt; \"${ENV_FILE}\"\nACCOUNT=${EMAIL}\nSOURCE_PASSWORD=${SRC_PASS}\nDEST_PASSWORD=${DST_PASS}\nEOF\n    chmod 600 \"${ENV_FILE}\"\n\n    while [ $(systemctl list-units --type=service --state=running 'imapsync@*' | grep -c 'imapsync@') -ge ${MAX_CONCURRENT} ]; do\n        sleep 5\n    done\n\n    echo \"Dispatching migration worker for: ${EMAIL}\"\n    systemctl start \"imapsync@${SAFE_NAME}.service\"\ndone &lt; \"${CSV_FILE}\"\n\necho \"All migration tasks dispatched. Monitoring completion...\"\nwhile [ $(systemctl list-units --type=service --state=running 'imapsync@*' | grep -c 'imapsync@') -gt 0 ]; do\n    RUNNING_COUNT=$(systemctl list-units --type=service --state=running 'imapsync@*' | grep -c 'imapsync@')\n    echo \"Active synchronization workers: ${RUNNING_COUNT}\"\n    sleep 10\ndone\n\necho \"Batch migration process completed successfully.\"<\/code><\/pre>\n<h2>Phase 4: The Zero-Loss Cutover Blueprint: DNS MX and Delta Synchronization<\/h2>\n<p>The single greatest point of failure in email migrations is premature DNS switching. Email routing on the public Internet relies on Mail Exchange (MX) records. Due to aggressive resolver caching across global ISPs, changing an MX record does not redirect mail traffic instantly. Below is the deterministic 5-step operational timeline that guarantees zero message loss.<\/p>\n<ol>\n<li><strong>T-Minus 48 Hours: TTL Reduction:<\/strong> Access your authoritative DNS management console and lower the Time-To-Live (TTL) of your domain&#8217;s MX, SPF (TXT), and DKIM records to 300 seconds (5 minutes). This ensures that once the final cutover takes place, global recursive resolvers expire old routing data rapidly.<\/li>\n<li><strong>T-Minus 24 Hours: Baseline Bulk Synchronization:<\/strong> Execute the initial bulk pass across all mailboxes using the batch orchestrator. This baseline pass transfers 98% of all historic mail volume while end-users continue using the legacy server.<\/li>\n<li><strong>Cutover Hour (T = 0): DNS Redirection:<\/strong> Point your domain&#8217;s primary MX record (priority 10) to your new mail infrastructure at <a href=\"https:\/\/merahost.org\">MeraHost Enterprise Cloud<\/a>. If your legacy provider allows it, configure temporary split-domain transport or forwarders pointing to the destination server IP.<\/li>\n<li><strong>T-Plus 15 Minutes: Final Delta Synchronization:<\/strong> Once new mail begins arriving at the destination server, execute a rapid secondary delta pass with <code>sync-mailbox.sh<\/code>. Because <code>imapsync<\/code> utilizes cached header indices, this pass only synchronizes the handful of messages that landed on the legacy server during the 15-minute DNS propagation window.<\/li>\n<li><strong>T-Plus 48 Hours: Final Audit &amp; TTL Restoration:<\/strong> Execute a terminal dry-run verification. Once message counts match perfectly, increase your MX TTL back to 86400 seconds (24 hours) to minimize DNS lookup overhead.<\/li>\n<\/ol>\n<blockquote class=\"wp-block-quote\" style=\"background:#f9f9f9;border-left:4px solid #001b41;padding:16px 20px;margin:24px 0\">\n<p><strong style=\"color:#001b41\">Architecture Note:<\/strong> If your source email server supports Dual Delivery (common in Google Workspace and Microsoft 365 migrations), enable dual-delivery routing during the cutover window. The source server will automatically fork copies of every incoming message to the destination server over SMTP, eliminating any potential gap during DNS propagation.<\/p>\n<\/blockquote>\n<h2>Phase 5: Post-Cutover Integrity Verification and Maildir Validation<\/h2>\n<p>Never consider an email migration complete until programmatic message reconciliation verifies byte-level counts across all mailboxes. On the target Linux host running Dovecot, execute direct verification using the <code>doveadm<\/code> administrative command set.<\/p>\n<pre class=\"wp-block-code\" style=\"background:#f3f3f3;color:#333;padding:16px;border-left:4px solid #001b41;font-family:monospace;font-size:13px\"><code>#!\/usr\/bin\/env bash\n# Verify mailbox integrity and folder message counts on destination host\nUSER_EMAIL=\"user@company.com\"\n\necho \"=== Mailbox Folder Message Count Verification ===\"\ndoveadm mailbox status -u \"${USER_EMAIL}\" messages \"*\"\n\necho \"=== Unread Message Verification ===\"\ndoveadm mailbox status -u \"${USER_EMAIL}\" unseen \"INBOX\"\n\necho \"=== Recalculating Mailbox Quota Allocation ===\"\ndoveadm quota recalc -u \"${USER_EMAIL}\"<\/code><\/pre>\n<p>For organizations deploying enterprise cloud infrastructure on <a href=\"https:\/\/merahost.org\">MeraHost<\/a>, underlying pure Enterprise NVMe arrays deliver sustained random I\/O operations per second (IOPS), ensuring that index rebuilds, Dovecot Lucene\/FTS search indexing, and real-time spam filtering occur instantaneously with zero lag on active user connections.<\/p>\n<h2>Frequently Asked Questions: Enterprise Business Email Migration<\/h2>\n<details class=\"wp-block-group\" style=\"background:#f9f9f9;border:1px solid #e7e7e7;border-radius:4px;padding:14px;margin-bottom:12px\">\n<summary style=\"cursor:pointer;font-weight:600;color:#001b41\">How does delta synchronization prevent duplicate messages in the destination inbox?<\/summary>\n<p style=\"margin-top:10px;color:#444\">Delta synchronization uses the immutable RFC 2822 <code>Message-ID<\/code> header combined with a persistent local SQLite cache. During the second synchronization pass, <code>imapsync<\/code> queries the destination folder&#8217;s message catalog. If a message with the identical <code>Message-ID<\/code> and message body size already exists, it is instantly skipped without transferring data over the wire, completely avoiding duplicates.<\/p>\n<\/details>\n<details class=\"wp-block-group\" style=\"background:#f9f9f9;border:1px solid #e7e7e7;border-radius:4px;padding:14px;margin-bottom:12px\">\n<summary style=\"cursor:pointer;font-weight:600;color:#001b41\">What happens to incoming mail sent during the DNS MX propagation window?<\/summary>\n<p style=\"margin-top:10px;color:#444\">During DNS propagation, different sending MTAs across the Internet resolve either your old or new MX record depending on their local DNS cache. Messages sent to the old server are safely accepted and stored in the legacy inbox. Our secondary delta synchronization pass\u2014executed after changing MX records\u2014connects back to the legacy server and pulls these newly arrived messages over to the destination server, ensuring zero data loss.<\/p>\n<\/details>\n<details class=\"wp-block-group\" style=\"background:#f9f9f9;border:1px solid #e7e7e7;border-radius:4px;padding:14px;margin-bottom:12px\">\n<summary style=\"cursor:pointer;font-weight:600;color:#001b41\">Can IMAP sync preserve calendar events, contacts, and custom email rules?<\/summary>\n<p style=\"margin-top:10px;color:#444\">No. Standard IMAP is strictly an email storage and retrieval protocol. Calendar items (CalDAV), address books (CardDAV), and server-side filtering rules (Sieve scripts) operate outside the IMAP scope. To migrate calendars and contacts, export them via standard vCard\/iCal formats or use specialized CalDAV\/CardDAV sync tools. Sieve filtering rules should be transferred directly into Dovecot Sieve config files.<\/p>\n<\/details>\n<details class=\"wp-block-group\" style=\"background:#f9f9f9;border:1px solid #e7e7e7;border-radius:4px;padding:14px;margin-bottom:12px\">\n<summary style=\"cursor:pointer;font-weight:600;color:#001b41\">How do we prevent ISP IP blacklisting or connection throttling during large migrations?<\/summary>\n<p style=\"margin-top:10px;color:#444\">Major cloud mail providers (such as Microsoft 365 and Google Workspace) employ strict heuristics that throttle single IPs executing dozens of rapid concurrent logins. To prevent throttling, enforce rate limits using the <code>--maxbytespersecond<\/code> flag, cap simultaneous worker connections to 8-12 concurrent threads using our systemd batch script, and utilize persistent TLS sessions with generous timeout thresholds (<code>--timeout1 180<\/code>).<\/p>\n<\/details>\n<div class=\"wp-block-group has-background\" style=\"background:#f9f9f9;border:1px solid #e7e7e7;border-radius:8px;padding:32px;margin:40px 0;text-align:center\">\n<h3 style=\"color:#001b41;margin-top:0;font-size:24px;font-weight:700\">Deploy Enterprise-Grade Production Infrastructure<\/h3>\n<p style=\"color:#444;font-size:16px;line-height:1.6;max-width:680px;margin:12px auto 24px auto\">Need guaranteed performance with zero price hikes? Host mission-critical workloads on <strong style=\"color:#001b41\">MeraHost<\/strong> with pure Enterprise NVMe, LiteSpeed Web Server, and Same Renewal Price, Always (starting at \u20b999\/mo).<\/p>\n<div class=\"wp-block-buttons\" style=\"display:flex;gap:16px;justify-content:center;flex-wrap:wrap\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link\" href=\"https:\/\/merahost.org\" style=\"background:#001b41;color:#ffffff;font-weight:700;padding:12px 28px;border-radius:4px;text-decoration:none;display:inline-block;font-size:15px\">Explore MeraHost NVMe Cloud &rarr;<\/a><\/div>\n<div class=\"wp-block-button is-style-outline\"><a class=\"wp-block-button__link\" href=\"https:\/\/cpanelfree.com\" style=\"background:transparent;color:#001b41;font-weight:600;padding:12px 24px;border:2px solid #001b41;border-radius:4px;text-decoration:none;display:inline-block;font-size:15px\" rel=\"nofollow noopener\" target=\"_blank\">Deploy Free Staging on CpanelFree<\/a><\/div>\n<\/div>\n<\/div>\n\n\n<div class=\"kk-star-ratings kksr-auto kksr-align-left kksr-valign-bottom\"\n    data-payload='{&quot;align&quot;:&quot;left&quot;,&quot;id&quot;:&quot;1330&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;0&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;0&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;5&quot;,&quot;greet&quot;:&quot;Rate this post&quot;,&quot;legend&quot;:&quot;0\\\/5 - (0 votes)&quot;,&quot;size&quot;:&quot;20&quot;,&quot;title&quot;:&quot;Migrating Business Email Inboxes Without Losing a Single Message: IMAP Sync Tutorial&quot;,&quot;width&quot;:&quot;0&quot;,&quot;_legend&quot;:&quot;{score}\\\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>\n            \n<div class=\"kksr-stars\">\n    \n<div class=\"kksr-stars-inactive\">\n            <div class=\"kksr-star\" data-star=\"1\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 20px; height: 20px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"2\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 20px; height: 20px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"3\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 20px; height: 20px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"4\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 20px; height: 20px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"5\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 20px; height: 20px;\"><\/div>\n        <\/div>\n    <\/div>\n    \n<div class=\"kksr-stars-active\" style=\"width: 0px;\">\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 20px; height: 20px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 20px; height: 20px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 20px; height: 20px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 20px; height: 20px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 20px; height: 20px;\"><\/div>\n        <\/div>\n    <\/div>\n<\/div>\n                \n\n<div class=\"kksr-legend\" style=\"font-size: 16px;\">\n            <span class=\"kksr-muted\">Rate this post<\/span>\n    <\/div>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to migrate business email inboxes without losing messages using imapsync. Production configs, cutover strategies, and zero-downtime DNS blueprints.<\/p>\n","protected":false},"author":1,"featured_media":1329,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[165],"tags":[126,125,166,129,127],"class_list":["post-1330","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-migrations","tag-devops","tag-linux","tag-migrations","tag-performance","tag-sysadmin"],"_links":{"self":[{"href":"https:\/\/merahost.org\/blog\/wp-json\/wp\/v2\/posts\/1330","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/merahost.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/merahost.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/merahost.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/merahost.org\/blog\/wp-json\/wp\/v2\/comments?post=1330"}],"version-history":[{"count":0,"href":"https:\/\/merahost.org\/blog\/wp-json\/wp\/v2\/posts\/1330\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/merahost.org\/blog\/wp-json\/wp\/v2\/media\/1329"}],"wp:attachment":[{"href":"https:\/\/merahost.org\/blog\/wp-json\/wp\/v2\/media?parent=1330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/merahost.org\/blog\/wp-json\/wp\/v2\/categories?post=1330"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/merahost.org\/blog\/wp-json\/wp\/v2\/tags?post=1330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}