Migrating from any IMAP/POP3 server to Dovecot

dovecotimap

I am trying to synchronize two mailboxes which reside in different servers. This is due to a migration process. The old server is a courier server and needs to be accessed via IMAP, whereas the new server is a dovecot server. I am trying to follow the original Dovecot documentation. Unfortunately it is not specified where the configuration of the source IMAP needs to be set, when the doveadm script is run on the destination server. The documentation provides the settings, but does not mention which dovecot configuration file the settings have to be entered.

Best Answer

You can also do the following on the command-line without configuration files:

# doveadm -Dv  \
  -o imapc_host=<SOURCE_HOST> \
  -o imapc_user=<SOURCE_USERNAME> \
  -o imapc_password=<SOURCE_PASSWORD> \
  -o imapc_features=rfc822.size \
  -o imapc_ssl=starttls \
  -o mail_fsync=never \
   backup -R -u <DESTINATION_MAILBOX> imapc:

I had great problems, because my source IMAP only supports STARTTLS on port 143. -o imapc_ssl=starttls was a life-saver in my case.

You can make a sync after the initial backup with:

# doveadm -Dv \
  -o imapc_host=<SOURCE_HOST> \
  -o imapc_user=<SOURCE_USERNAME> \
  -o imapc_password=<SOURCE_PASSWORD> \
  -o imapc_features=rfc822.size \
  -o imapc_ssl=starttls \
  -o mail_fsync=never \
  sync -1 -R -u <DESTINATION_MAILBOX> imapc:

Of course, this is quite insecure if you have more users on the box that can see your commands (and passwords) with who or by looking into your .bash_history file, so beware.

Related Topic