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.
- 243
4 Answers
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.
- 91
If the two mail servers are running without problems with the IMAP protocol I would use imapsync to do the job. Both Courier and Dovecot are supported by imapsync.
It's really straightforward to use and support many features, like regexp mappings for different folder synchronisation.
The software is FOSS and can be found here: http://imapsync.lamiral.info
If you need the UID sync you can add the option --useuid in the imapsync. I'm not sure if you're talking about this kind of UID. But this is the option that you should be looking for:
--useuid : Use uid instead of header as a criterium to recognize messages. Option --usecache is then implied unless --nousecache is used.
- 5,870
You should migrate your mail using the dsync utility from Dovecot. This will preserve the UIDs and even POP3 UIDLs if necessary.
Run dsync using the backup -R option, to 'reverse backup' from the remote IMAP server to the local Dovecot server. You need to have a special configuration file created, something like this:
imapc_host = imap.company.com
imapc_user = %u@company.com
imapc_password = mypassword
imapc_features = rfc822.size fetch-headers
imapc_port = 143
pop3c_host = pop3host.company.com
pop3c_user = %u@company.com
pop3c_password = mypassword
pop3c_port = 110
namespace pop3c {
prefix = POP3-MIGRATION-NS/
location = pop3c:~/pop3c
list = no
hidden = yes
}
!include /etc/dovecot/dovecot.conf
plugin {
pop3_migration_mailbox = POP3-MIGRATION-NS/INBOX
pop3_migration_skip_size_check = yes
pop3_migration_ignore_missing_uidls=yes
}
mail_prefetch_count = 20
mail_shared_explicit_inbox = no
protocol doveadm {
mail_plugins = $mail_plugins pop3_migration
}
Note this is for a single user; you may want to have different options if you use a master user/password, or if you require SSL for the connections.
Then call it with something like:
dsync -D -v -u username -c configfile.cfg
The username replaces the %u in the config.cfg file. The -D -v is verbose debug mode.
- 805
You need to include those settings in Dovecot configuration,
usually Dovecot configs are in /etc/dovecot/.
Best would be to place the configuration in /etc/dovecot/conf.d/90-migration.conf (all files in conf.d dir are automatically included).
To reload the config you need to run:
sudo doveadm reload
- 1,489
- 3
- 21
- 28