Using imapsync to transfer from cyrus to dbmail
By Michael Monnerie firstname.lastname@example.org
We used to use cyrus imapd as our mailserver, but were not really happy about cyradm, the administration tool for it. Now we wanted to switch to dbmail, and had the problem of transferring some 20GB of e-mail to the new server. We could have just setup the users on the new box, and tell every user to move their mails on their own. But, there's a more convenient way.
With a lot of experimentation, we found these parameters to be best suited for the transfer. There were some issues when using the tool with dbmail 2.2.1, but after an upgrade to 2.2.2 it's working without problems:
imapsync --host1 cyrus.host.at --user1 cyrususer --authuser1 cyrususer --password1 xxx --ssl1 --sep1 '/' \ --host2 dbmail.xxx.at --user2 dbmailusr --authuser2 dbmailusr --password2 yyy --authmech2 LOGIN \ --skipheader '^(X-|Received|MIME-|Content-|Disposition-|From|Cc|Reply-|Subject|To|DomainKey|Date).*' \ --skipsize --syncinternaldates --regextrans2 's/^user.//' --delete2 --expunge2 --exclude 'user/unwanted.*'
Of course you have to fit user/pwd, and the dbmail user used must have access to all mailboxes. The “skipheader” was used to exclude most headers, as dbmail uses gmail, which seems to modify headers during the transfer (mostly adding some spaces). The “regextrans2” is used to change names from “user.michael” to just “michael” to dbmail. The exclude is there as an example.
I made the transfer using just one user on the dbmail side, so afterwards I had to change the owner of every corresponding messages/mailboxes to the correct user.
Until you still have write permissions to mailboxes, you can easily rerun imapsync, until you finally switch off the old host.