Situation
John Smith Ltd is leaving the old mail server (198.51.100.90, run by an external
provider) and moving to Atlas. There are four mailboxes to bring over: jsmith,
jgreen, jbrown and pblack. Each has years of messages and folders. Nobody must
lose anything, and nobody must be left without mail even for a day.
The Tools → IMAP Import page copies the content of a mailbox on another IMAP server into the corresponding mailbox on Atlas. It moves nothing: the old server stays as it is. This gives you the freedom to do the migration in two stages: a big copy in advance, while everyone is still working on the old server, and a quick copy of the last day, on the day of the switch.
Warning The page imports only from an external server: local-network, loopback and private addresses are refused. In the example the old server is external (198.51.100.90) and the migration works. If your old server is instead on the LAN (an Exchange or a Zimbra in a cabinet in the office), first read the section “If the old server is on the LAN”: the console, as it is, does not reach it.
The plan:
- prepare the mailboxes on Atlas (accounts, space, firewall, trust);
- run a dry run on one mailbox;
- make the first copy of all the mailboxes, queued;
- on the day of the switch: change the MX and make the final copy;
- give the users the new details, check, and clean up.
What you need
- A console administrator account (
lwhite). - For each mailbox: login and password on the old server (with
<password>as the placeholder in the examples). If you do not have them, ask the provider, or ask that each user’s password be reset for the duration of the migration: the console does not store the remote password, it uses it only for the job. - The name of the old IMAP server and the port (normally 993 with TLS) and whether its certificate is valid: an expired or self-signed certificate forces you to tick «Skip certificate verification».
- The Atlas accounts already created, with mail enabled (Users).
- The space: the sum of the mailboxes on the old server, plus a margin.
- The mail domain already on Atlas (Mail). For
johnsmith.testthis is already so; for a new domain see A second mail domain.
Steps
1. Prepare Atlas
- Open Active Directory → Users and for each user to migrate (
jsmith,jgreen,jbrown,pblack) check the «Features» block. «Mailbox access» must be on: the import page offers as destination only the users with mail (IMAP) enabled. If a user is missing from the «System user» selector, this is almost always why. - In the same block check «Mail storage» (normally
5120MB). If the mailbox on the old server weighs 8 GB, raise the value to10240and press «Save»: a mailbox that fills up halfway through the copy makes the import fail. - Open System → Status and look at the «Email» volume in the «Disk» panel: it must have room for the sum of all the mailboxes. Amber from 75%, red from 90%.
- If during the migration the old server will keep forwarding mail to Atlas, add its
address to Mail → Filters and lists → Trusted addresses («Add entry» item, «IP
address or range»
198.51.100.90, «Note»old server, migration). Keep it as a reminder to remove the entry when the migration is over. - Check the time of the automatic updates in System → Settings → Updates («Update time»): the import queue is in Atlas’s memory, and a restart of Atlas empties it (an update can restart it). Do not leave long imports straddling the window, or move it by a night.
2. A dry run on one mailbox
- Open Tools → IMAP Import.
- In «Source server»: «Remote IMAP server»
198.51.100.90; «Remote login»jgreen@johnsmith.test(the login as the old server knows it); «Remote password»<password>; «Use TLS (IMAPS)» on. If the old server’s certificate is not valid, turn on «Skip certificate verification». - In «Destination»: «System user»
Green Jack (jgreen); leave «Destination folder (optional)» empty; turn on «Dry run (report only, no changes)». - Press «Queue import». «Import queued» appears.
- In «Queue & history» the row goes from «Queued» to «Running» and to «Completed» (with the «dry run» label).
- Press «Download the log» on the row: it is the text printed by
imapsync. Check that it sees all the folders and the number of messages you expect. This is the moment to discover a wrong password, an invalid certificate or a folder with a strange name, before copying for real.
Tip A login the old server accepts can be different from the Atlas user name: on the old server it is often the full address, on Atlas it is
jgreen. The two fields are independent: «Remote login» is the user over there, «System user» is the mailbox over here.
3. The first copy, while everyone is still working on the old server
- Turn off «Dry run (report only, no changes)» and press «Queue import». After sending, the form empties the password and the destination, but keeps the source server: that way you queue the other mailboxes in a row without rewriting anything.
- For each mailbox change «Remote login», «Remote password» and «System user»:
jbrown,pblack,jsmith. Press «Queue import» each time. - The imports start one at a time, in order of arrival. A large mailbox can take hours: there is no deadline and you can close the page, the job carries on. The outcome also arrives in the notifications (the bell, «IMAP imports»).
- If a row becomes «Failed», press «Download the log» and read the end: the typical causes are a wrong password, an invalid certificate (turn on «Skip certificate verification» and queue again), a full destination mailbox (step 2 of the preparation) or a block by the old server for too many logins (retry later). To stop a job you do not need, «Stop»: the messages already copied stay.
For the technician The import runs in a container with
imapsync, on the services’ internal network. On the Atlas side it authenticates as<user>*<master user>with Dovecot’s master login: the local user’s password is not needed. The remote side uses--ssl1if «Use TLS (IMAPS)» is on. The remote password goes through a 0600 file that exists only for the duration of the job. It never deletes anything on the source server.
4. The day of the switch
Warn the users: the last day’s mail is yet to be copied and their mail program will change server.
- The day before, lower the TTL of the MX record (and of the name’s A records) in the public DNS, at the domain’s provider: the lower it is, the faster the switch.
- On the evening of the switch, in the public DNS, change the domain’s MX record
so that it points to Atlas’s internet name (
atlas.johnsmith.test, 10), as explained in A second mail domain. From that moment new mail arrives at Atlas. During the propagation time some mail still arrives at the old server. - Check that new mail arrives: in Mail → Logs → Traffic the «Received» totals grow, and a test message from outside appears in the mailbox.
- Redo the copy of all the mailboxes, with the same procedure as step 3. The tool normally copies only what is missing in the destination mailbox, so the second pass is much faster than the first. If you want to verify it, first make a «Dry run» and read the log: it lists what would be copied.
- Repeat after a day or two, when the MX propagation is over, to collect the mail that reached the old server late.
5. The users move to Atlas
- Everyone opens their mail from the webmail (Tools → Mail, see
Groupware) or configures their mail program on the new server:
server
atlas.johnsmith.test, IMAP 993, sending 587. Programs that use automatic configuration (Thunderbird, Outlook) find it by themselves if the DNS has the namesautoconfigandautodiscover. - Users who have rules, signatures and address books on the old server recreate them: the page copies only messages and folders. For the rules (automatic reply, filters) there is the «Mail rules» tab (Groupware).
- When the migration is over, remove the entry
198.51.100.90from «Trusted addresses», if you added it, and keep the old server read-only for a month before switching it off.
If the old server is on the LAN
It is the most common case after the external one, and the most important to understand: the page refuses a server on the internal network. The check happens when you press «Queue import» (not afterwards, in the queue): the «Remote IMAP server» field turns red with «It is a local-network, loopback or private address: imports only come from an outside server».
What is forbidden. The rule applies to the address, not the name: the addresses
10.x, 172.16.x–172.31.x, 192.168.x, 127.x, 169.254.x, 100.64.x–100.127.x,
0.x, ::1, fe80:: and the IPv6 local addresses (fc00::/7) are refused, and also
a name that resolves to one of these. A name that the internal DNS resolves to a
private address is therefore refused like the address itself.
Why. The page can also be used by an ordinary user (it imports into their own
mailbox). Without the ban, any user of the domain could use it to probe the internal
network: imapsync’s error message would reveal which ports are open and which
services answer. That is why there is no setting to widen the ban.
What you can really do. None of the four ways is a function of the page: choose knowingly.
- Give the old server a public address, for the time of the migration. If the router (in the example company Argos, see the Argos manual, chapter “Publications”) can publish port 993 of the old server on a public address, write in the «Remote IMAP server» field that public address (an IP, or a name that the public DNS resolves to a public IP). The check looks at the address and accepts it. Limit the publication to Atlas’s public address (198.51.100.40) as the source, and remove it when the migration is over. One difficulty: Atlas starts from the LAN and reaches its own public address, so the router must allow it (the “hairpin” of the Argos chapter; if it does not, the connection is not established and the job fails). It is not verified that it works in every configuration.
- Copy with a program on your PC (outside the console).
imapsyncis a free tool: installed on a PC or server of the LAN that reaches both servers, it copies from the old one to the new one. As destination it needs the password of the mailbox on Atlas (forjgreen, his domain account) (the console does not give you that password: it must be asked of the user or reset). The procedure is outside the console and this manual does not describe it. - Copy with the user’s mail program. Add both accounts (old and new) in the same Outlook or Thunderbird and drag the folders from one to the other. It is slow, fine for one or two small mailboxes, and keeps the folders.
- Remove the ban with a service environment variable. The code knows a variable,
EDON_IMAPSYNC_ALLOW_PRIVATE_TARGETS=1, which removes the check. It is meant for tests on a lab appliance; it is not documented as a supported function and this manual does not propose it as a procedure. Whoever uses it must know that while it is active any user of the domain can probe the internal network with that page, and that it requires a restart of Atlas (which empties the queue). If you get there, remove the variable as soon as you have finished.
Warning Whichever way you choose, do not expose the old server to the internet without limiting it to Atlas’s address and without TLS. Publishing an old, un-updated IMAP is a bigger risk than the problem you are solving.
Check
- Every import is «Completed», none «Failed». In each one’s log, at the bottom,
imapsyncsummarises the folders and messages copied and any errors. - For each mailbox, open the webmail (or ask the user) and compare with the old server the number of messages in the «Inbox» and in two or three folders of your choice, and check an old message with an attachment.
- In System → Status, «Mailboxes» panel, each mailbox shows a plausible used space against the limit; the «Email» volume is not amber.
- A test message from an external address reaches Atlas (not the old server): after the MX propagation, Mail → Logs → Traffic counts it in «Received».
- The old server has lost nothing: the page never deletes on the source server.
If something goes wrong
| Symptom | Likely cause | Remedy |
|---|---|---|
| «It is a local-network, loopback or private address…» | The old server is on the LAN, or the name resolves to a private address | Section “If the old server is on the LAN” |
| «Enter a host name or an address, with a port if needed (e.g. imap.example.com:993)» | Field empty or with invalid characters | Type host or host:port, without a scheme |
| «This field is required» | Server, login, password or user is missing | Fill in the bold fields |
| The «System user» selector does not contain the user | «Mailbox access» off, or not a domain user | The user’s page, «Features» |
| «Failed» with an authentication error | Wrong password, or the old server requires a different method | «Download the log»; retry with the right password |
| «Failed» with a certificate error | Expired or self-signed certificate, or a different name | Turn on «Skip certificate verification» (it also accepts fake certificates: use it only for a server you know) |
| «Failed» halfway with quota errors | The destination mailbox is full | Raise the user’s «Mail storage» and queue again |
| The row vanished from the queue after a restart | The queue is in Atlas’s memory | Queue again; download the logs when the job is over, because they are lost |
| «The import could not be stopped: it may have finished already.» | The job finished while you were pressing | Reload the page |
Limits
- External servers only (see above): it is the console’s rule, not an error.
- One import at a time, in order of arrival. Four large mailboxes are four jobs in a row.
- The queue and the logs do not survive a restart of Atlas. Those in progress are no longer followed; those queued must be queued again.
- Messages and folders are copied: not rules, signatures, address books, calendars (for those, export and import in the respective tools).
- The page can also be used by an ordinary user, for their own mailbox (address
/system/tools/imapsync); it is not in their menu. If a user wants to import old personal mail from an external service, they can do it themselves; for company servers on the LAN the administrator is needed anyway. - The job can take hours for a large mailbox and has no deadline, but it can be stopped at any time.