EN · $ USD
Business Email and Mail Servers

How to Migrate Email from an Old Server to a New Host

7 min read Updated: Sunucu Atlas technical team

In short

Email migration means copying every folder and message in your mailboxes from the old server to the new one over IMAP. The most reliable method is to run an initial sync with imapsync, change the MX record, and run a second sync once DNS propagation finishes. If you keep the old service active for a few days, no mail is lost during the switch.

In this guide
  1. Before you start: take inventory
  2. The right order to avoid losing mail
  3. Method 1: server-side migration with imapsync
  4. Method 2: client-based migration with Outlook or Thunderbird
  5. Method comparison
  6. Common migration problems
  7. Post-migration checklist
  8. Next step: get your new mailboxes ready

Email migration is the process of moving every folder and message in your business mailboxes from your old provider to your new host. Done in the right order, your users will barely notice the switch: first the mailboxes are created on the new server, old mail is copied over IMAP, then the MX record is changed, and a final sync runs once DNS propagation is complete. This guide covers server-side migration with imapsync, the client-based alternative, and a timeline that prevents lost mail.

Before you start: take inventory

Most lost mail comes not from the migration itself but from a forgotten address. Pull this list from your old panel:

  • Every mailbox and the space each one uses (in GB)
  • Aliases, forwarders and auto-replies
  • The catch-all (default address) setting
  • Current DNS records: MX, SPF (TXT), DKIM, DMARC, and the mail / webmail subdomains used for webmail
  • Whether users read mail over IMAP or POP3

That last item is critical. For a user on POP3, mail has usually been deleted from the server and lives only in the Outlook data file on their computer. A server-side migration cannot see that mail; for that user you need the client-based method. For a detailed comparison, see our article on IMAP vs. POP3.

Compare mailbox sizes with the new plan's per-account quota. For example, you cannot fit an 8 GB mailbox into a plan that allows 5 GB per account; either archive old mail or choose a larger plan such as the SA-MAIL-3 email hosting plan, which offers up to 10 GB per account and 60 GB in total.

The right order to avoid losing mail

The timeline below is designed so that no message gets dropped during the switch:

  1. Lower the MX record's TTL 24-48 hours before the switch. In the old DNS panel, set the MX record's TTL to 300 seconds. This makes the MX change propagate worldwide faster.
  2. Create the mailboxes on the new host. Use the same names. If you are giving users new passwords, announce them once the migration is complete.
  3. Run the initial sync. While the old server is still receiving mail, copy the full history with imapsync. This is the longest step.
  4. Update your DNS records. Point the MX record to the new server, update the SPF record to include the new server, and publish the new server's DKIM key.
  5. Keep the old service active. During propagation, some senders will still deliver to the old server. Do not cancel the old account for at least 3-7 days.
  6. Run the second (incremental) sync. After 24-72 hours, run imapsync again with the same parameters. The tool skips messages it already copied and transfers only new ones that reached the old server in the meantime.
  7. Update email clients and do a final check. Change the server names in Outlook and on phones; a few days later, run one last sync and shut down the old service.

We explain how long DNS changes take to propagate and how to check them in our DNS propagation guide.

Method 1: server-side migration with imapsync

imapsync is an open-source command-line tool that syncs mailboxes between two IMAP servers. It preserves folder structure, read/unread flags and dates, and when you run the same command again it copies only missing messages. That makes it the standard tool for a zero-downtime migration.

Installation

The easiest way is to use the official Docker image. On a Linux server or computer with Docker installed, this command is all you need:

docker pull gilleslamiral/imapsync

If you do not use Docker, Debian/Ubuntu distributions may have a version in their package repositories; current installation options are listed on the official imapsync website.

Migrating a single mailbox

Start with a test run using --dry; this parameter shows what would happen without copying anything:

docker run --rm gilleslamiral/imapsync imapsync \
  --host1 mail.eskisaglayici.com --user1 info@firmaniz.com --password1 'EskiSifre' --ssl1 \
  --host2 mail.firmaniz.com --user2 info@firmaniz.com --password2 'YeniSifre' --ssl2 \
  --automap --dry

If the folder mappings in the output look right, remove --dry and start the real migration. The --automap parameter automatically maps special folders with different names, such as "Sent", "Gönderilmiş Öğeler" or "Sent Items", to their counterparts on the new server. --ssl1 and --ssl2 connect over the encrypted IMAP port 993.

Bulk migration

For many mailboxes, prepare a CSV file (kullanici;eski_sifre;yeni_sifre, i.e. user;old password;new password) and run it in a simple loop:

#!/bin/bash
while IFS=';' read -r USER PASS1 PASS2; do
  docker run --rm gilleslamiral/imapsync imapsync \
    --host1 mail.eskisaglayici.com --user1 "$USER" --password1 "$PASS1" --ssl1 \
    --host2 mail.firmaniz.com --user2 "$USER" --password2 "$PASS2" --ssl2 \
    --automap > "log_${USER}.txt"
done < hesaplar.csv

The end of each mailbox's log file shows the error count and the number of messages transferred. When the migration is done, delete these files securely; they contain passwords.

Things to watch out for

  • Do not use deletion parameters such as --delete2 unless you are sure what they do; they can delete messages on the destination.
  • If your old provider limits the number of IMAP connections, migrate mailboxes one after another, not in parallel.
  • If an account's quota on the new server is full, imapsync reports an error; search the log file for quota errors.

Method 2: client-based migration with Outlook or Thunderbird

If you only have a few mailboxes or prefer not to use the command line, you can migrate through an email client:

  1. Add the old account to Thunderbird or Outlook as IMAP and wait for all folders to download.
  2. Add the account on the new host as a separate IMAP account. You will find the required server settings in our Outlook IMAP/SMTP setup guide.
  3. Drag the folders from the old account to the new account to copy them.
  4. When syncing finishes, compare the message counts in the new account with the old one.

The method is the same for POP3 users whose mail exists only on their computer: when you drag mail from local folders into the new IMAP account, it is uploaded to the server. This method is slow and the computer must stay on; for large mailboxes, imapsync is always more reliable.

Method comparison

CriterionimapsyncClient (Outlook/Thunderbird)
Suitable number of mailboxesOne to hundredsA few mailboxes
Incremental syncYes, just run it againNo, you have to drag again manually
Preserves folders and flagsYesMostly yes
Mail stored locally via POP3Cannot migrate itCan migrate it
Technical skill neededMediumLow

Common migration problems

Authentication failed error

If imapsync fails at authentication, first check that the username is the full email address. Some older panels use different formats such as info+firmaniz.com as the username. If the password contains characters like $ or !, the shell may interpret them; wrap the password in single quotes or read it from a file with the --passfile1 parameter.

Sent items show up in two separate folders

If the old server uses "Sent" and the new one uses "Sent Items", and --automap was not added, you end up with two separate folders. Rerun the migration with that parameter; you can delete the empty folder afterward.

Migration is very slow

Slowness usually comes from the old server's connection limits. Migrate large mailboxes outside business hours and start the initial sync a few days before the MX change; incremental syncs take far less time.

Calendar and contacts were not migrated

IMAP only moves mail. Export calendars and contact lists from the old webmail as .ics and .vcf files and import them on the new side.

Post-migration checklist

  • Send a test email to each mailbox from an outside address (for example, a personal Gmail) and confirm it lands on the new server.
  • Send mail out from the new server and check that the message headers on the recipient's side show spf=pass and dkim=pass. If you do not see them, recheck your SPF and DKIM records.
  • Recreate aliases, forwarders and auto-replies in the new panel; they are not migrated over IMAP.
  • Remove the old accounts from phones and add them again with the new server name.
  • A week after the MX change, confirm that no new mail is piling up on the old server, then shut down the old service.

Next step: get your new mailboxes ready

The first step of a migration is a destination with enough accounts and quota. Sunucu Atlas business email hosting plans run on servers in Istanbul and come with Roundcube webmail, SSL-secured IMAP/POP3/SMTP, SPF and DKIM; because they work independently of your website, you can move just your email without moving the site. For companies with dozens of users and large archives, SA-MAIL-3, with 100 email accounts and up to 10 GB per account, is the most comfortable option. If you get stuck during migration, you can open a support ticket in Turkish.

Frequently asked questions

Is incoming mail lost during an email migration?

No, as long as you keep the old service active for a few days after the MX change and run a second imapsync sync once DNS propagation finishes. That sync moves any mail that reached the old server in the meantime to the new server.

Does imapsync copy the same message twice?

No. imapsync recognizes messages it already copied by their header information and, when run again, transfers only the missing ones. That makes incremental syncs safe.

Can I migrate email without knowing the mailbox passwords?

IMAP-based migration needs the account password on both sides. If you do not know the passwords, you can temporarily reset them in the old panel and give users new passwords once the migration is done.

Are aliases and forwarders migrated too?

No. IMAP only moves the messages and folders in a mailbox. You need to recreate aliases, forwarders and auto-replies manually in the new panel.

Can I migrate only my email without moving my website?

Yes. You change only the MX and related mail DNS records; the A record keeps pointing to the old server and the site is not affected. A separate email hosting plan that does not host a website suits this scenario.

For this guide

Recommended plans

Sunucu Atlas email hosting lets you move just your mailboxes to servers in Istanbul without touching your website, and SA-MAIL-3 fits large archives with up to 10 GB per account.

Recommended

5 Email Accounts

$0.49/mo

+VAT

  • LocationIstanbul
  • 10 GB Total Storage
  • Up to 2 GB per Account
  • Webmail (Roundcube)
  • IMAP / POP3 / SMTP (SSL)

25 Email Accounts

$1.18/mo

+VAT

  • LocationIstanbul
  • 30 GB Total Storage
  • Up to 5 GB per Account
  • Webmail (Roundcube)
  • IMAP / POP3 / SMTP (SSL)

100 Email Accounts

$2.55/mo

+VAT

  • LocationIstanbul
  • 60 GB Total Storage
  • Up to 10 GB per Account
  • Webmail (Roundcube)
  • IMAP / POP3 / SMTP (SSL)

Mail Hosting — tüm paketler

Need help with setup?

Send questions about your service in a support ticket, and our technical team will walk you through it step by step.