While setting up my new server I also had to migrate all my emails.
Courier saves all emails as files that can simply be copied to the new server. The files are saved in the following directory:
To copy the files scp is the easiest and fastes way. Executing the following command on the new server copies the Mailbox folder from the old server to the new one:
If you don’t use key authentication it asks for the password of
scp doesn’t transfer the file permissions so the copied files are owned by the user that executed scp. Because of that courier will rise many errors when you first try do download the emails in your client of choice. The Mailbox folder and all files in it must be owned by the same user and group than the other files in the
/var/qmail/<domain>/<name>/ directory. With
ls -l the owner and group can be found.
So user and group is
popuser. To change the owner of all files in the Mailbox directory execute
The second thing I did and I don’t really know if it is mandatory, is to delete the
courierimapuiddb file. Courier creates a new one when emails are fetched the next time, but can have problems if the file does not coincide with the email files.