Move mail from server A to server B

4 posts / 0 new
Last post
#1 Thu, 02/26/2015 - 07:03
remibruggeman

Move mail from server A to server B

Hey,

As I'm setting up my new server, I need to migrate all my 'clients'. Doing this might invoke loss of mail, due to the DNS changes, where the user is already on the new server, but some mail is still being sent to the old one. I'd like to do an rsync the day after the move to sync the remaining files. I did this for one user already, but it does not seem to have the desired effect.

rsync -iva -e "ssh -p 6000" old_server_ip:/home/oldclient/Maildir/ /home/newclient/Maildir/
chown -R user:user /home/user/Maildir/*

The new server owner has a different name, so we have the following:

old sever: user: oldclient
new server: user: newclient

I did some googling, and found the following post: http://www.virtualmin.com/node/9846

I fail to see where I can define where the old server is defined. The change of the server owner has only been done for 1 domain. If this is a problem, I'd still like to know how to use the above script to transfer the mails of other clients.

Thanks so much for any help.

Thu, 02/26/2015 - 14:37
andreychek

Howdy,

Hmm, at first glance, I don't see anything that wouldn't work with what you described above. Are you running into an issue of some sort?

All that said, I've had luck using the tool "imapsync" to perform tasks like that in the past, it does a great job of copying new email from one system to another. It works similarly to rsync, but it runs over IMAP and is designed just for copying email.

-Eric

Fri, 02/27/2015 - 02:03
remibruggeman

Hey Eric,

After I moved the Maildir I wanted to see if the mail was really moved. So I went to a roundcube on the new server (on a different domain) and logged in with the e-mail address of the mail I moved. However, I get the notification that there's no mail in the inbox.

Anything I could be doing wrong or forgetting?

Thanks for the tip about imapsync. I'll have a look at it also.

Sat, 02/28/2015 - 03:09
remibruggeman

Ah. I think I see what I did wrong. I moved the files from server A to B, but I did not use the "virtualmin copy-mailbox" command. i will execute a new transfer later today when I have some time.

Topic locked