[Dovecot] integration of old mails into new dovecot Maildir
Jiri Bourek
bourek at thinline.cz
Mon Apr 14 21:32:34 UTC 2014
>
> Yes, the new server is functional and all the users are able to log in, view
> delivered messages and retrieve the messages into their mail clients.
> However, they cannot view any old messages or retrieve any old messages.
>
If I wanted to do this, I'd probably use something along these lines:
- get IMAP access to your users' mailboxes. No need to know their
passwords, you can set up master user for that, see wiki:
http://wiki2.dovecot.org/Authentication/MasterUsers
(this needs to be set up on the old server)
- run this command on new server. (Let's say your master user is called
"admin" and you set auth_master_user_separator = * )
doveadm -o plugin/sieve_dir= \
-o imapc_user=user at example.org*admin \
-o imapc_password=adminspassword \
-o imapc_host=oldbox.example.org \
-o imapc_ssl=starttls \
-o imapc_ssl_verify=yes \
-o ssl_client_ca_dir=/etc/ssl/ \
-o mail_fsync=never \
import -u user at example.org imapc: "" mailbox inbox
(Rinse and repeat for every user, the only thing that changes between
runs is username in imapc_user=xxx and -u xxx)
This command uses Dovecot's builtin IMAP client to connect to your old
server, downloads messages and stores them into specified user's mailbox
on new server. New mail should be preserved in the process, so should
messages' UIDs.
It's pretty much the same as described here -
http://wiki2.dovecot.org/Migration/Dsync - you just use import instead
of dsync (from my experience dsync doesn't do what you need in this
scenario.)
The -o plugin/sieve_dir= line prevents Dovecot from trying to import
Sieve scripts (which doesn't work for me, they're not writable in my
setup and doveadm segfaults.) If you don't use sieve plugin or you can
import Sieve scripts this way, you can omit that.
Rest of parameters is pretty straightforward, see man doveadm-import for
explanations. You can use "ALL" instead of "mailbox inbox" to import
messages from all IMAP folders (add -s parameter in that case)
And of course - this is pretty much untested (tried on one mailbox), so
use on your own risk.
More information about the dovecot
mailing list