Email Mailbox copy

Discussion in 'General' started by onastvar, Jan 9, 2020.

  1. onastvar

    onastvar Member


    I had a client who changed domain ( to
    They wanted to copy entire email/folders account from (old) [email protected] to (new) [email protected]
    I did the following (I have done this in the past and it worked)

    1) rsync -avzh [email protected]:/var/vmail/ /var/vmail/
    2) chown -R vmail:vmail /var/vmail/domain2

    I can see folders & subfolders got copied via rsync (Maildir sieve)
    when I login to webmail/roundcube under (new) [email protected]
    I don't see any messages.

    I appreciate any assistance.
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    That should work if the directory structure on the target server is same as in old, that is extra directory level was not created by mistake or something. Maybe running doveadm command with suitable arguments on the target server would fix it? On the other hand, did you check the mailbox worked before you copied the old mails there?
    If not, there are other ways to transfer e-mailboxes from server to server. Try Internet Search Engines with
    Code: migrate e-mail
  3. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    I assume the domain already exists as another maildomain, so it's just the one mailbox you're trying to change?
    as far as i'm aware, if you go into the mailbox settings in ispconfig and just change the domain part then it will move/change all the files and folders for you. you'll need to manually change the domain part of the login field if you require the login to match the email address.

    I believe that's all you need to do, but you may want to create a couple of test domains and a mailbox to test it with first before doing anything to a live domain/mailbox. i know the files/folders will be changed for you if you change the maildomain in ispconfig, but I've can't remember ever trying it with just a mailbox.
    onastvar and Jesse Norell like this.
  4. onastvar

    onastvar Member

    Thank You so much @Taleman & @nhybgtvfr.
    I just went into email account of [email protected] and from dropdown changed from to and it worked. I can now see all the emails in webmail/roundcube.
  5. recin

    recin Member

    onastvar likes this.
  6. Steini86

    Steini86 Active Member

    Additionally for future reference ;)
    Only for dovecot imap servers
    Moving mails from one dovecot mailbox/maildir to another (or different folder inside a mailbox) should be done with doveadm move:
    Moving to from one server to dovecot should be done with dsync:
    This is the recommended way and preserves metadata/uids/etc. Otherwise it could happen that all mails are resynced, metadata is missing, migration takes much(!) longer, etc..
    onastvar and recin like this.

Share This Page