Help! My Host is Holding My Email For Ransom
Say your are at hosting company 'Poor Service' and you want to move to a new hosting company (for arguments sake, how about http://rimuhosting.com/
? The only problem is you have lots of email stored on your old host's server. In IMAP folders. Possibly for lots of users. And maybe for a number of domains.
So: how do you migrate your email to your new server? You have a few options.
The Low Tech Approach: Drag and Drop
Contrary to popular opinion low tech solutions are often the best option. Do the simplest thing possible (but no simpler).
In this case the solution is to add your new server imap details to your email client. Then drag and drop or copy email folders from one server to the other.
Copying Over Mail Files
Sometimes dragging and dropping is not feasible. For example, you may be doing this for lots of email users and it is not practical for them to all do the dragging and dropping.
In this case you can copy over the mail files. Use something like rsync (if you have ssh access to both servers) or FTP (if you lack ssh capability on the original host).
If each email 'folder' is stored in a single file then you have your email in the 'mbox' format (see http://www.qmail.org/qmail-manual-html/man5/mbox.html
). This is the most common mail format. It also happens to be the default format for most imap servers (e.g. uw-imap on WBEL3 and dovecot on RHEL4/Debian).
If you are copying over mbox files just pop them in each email user's home directory. Most commonly they are put in a subdirectory like 'Mail'. e.g. your Sent Items folder would be at "/home/$username/Mail/Sent Items"
You will also need the user's 'Inbox'. That file is typically stored at /var/spool/mail/$username.
If your original IMAP emails are in thousands of files in directories like tmp, cur or new then you are not using the mbox format. You are using the maildir format (see http://www.qmail.org/qmail-manual-html/man5/maildir.html
Dovecot supports this email storage format. So you should be able to copy over the maildir directories and configure dovecot to use maildir instead of mbox.
TODO: Add some detail about maildir (probably after we do a maildir -> maildir migration for someone).
TODO: Add some detail about maildir <-> mbox conversions when you want to go from one format to the other.
NOTE: mailbox/maildir comparison and conversion: http://people.redhat.com/rkeech/maildir-migration.txt
IMAP Sync is a command-line (Perl) tool to sync IMAP mailboxes.http://www.linux-france.org/prj/imapsync/README