1

Topic: Importing old email while new email exists

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.7
- Linux/BSD distribution name and version: Debian 9
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PGSQL
- Web server (Apache or Nginx): nginx
- Manage mail accounts with iRedadmin Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

If I have email (from the vmail folder) from an old iRedMail installation, and also a new iRedMail installation, how do I import the old email into the new installation? Do I just copy the email into the vmail folder?

Any risks I need to be aware of? Is there a chance of collision? Anything else?

Thanks.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Importing old email while new email exists

FYI: https://docs.iredmail.org/migrate.to.ne … erver.html

3 (edited by Nameless 2017-12-14 15:24:22)

Re: Importing old email while new email exists

Hey Zhang, thanks for the response! I think there's a difference between that tutorial and my scenario, though:

The tutorial assumes I'm moving an old iRedMail server into a new, empty server.

In my case, I had an old iRedMail server, and I want to move the data to a new iRedMail server that already has some data. I set up the new server from scratch, and I chose the same username and domain name, but since I used the installer on an empty server, I assume that in the database there will be differences in internal ids, passwords etc.

So my question is more about merging two iRedMail servers, one of which is currently active, rather than migrating one to a new one.

Given that, are there no differences in what I have to do?

4

Re: Importing old email while new email exists

1. EASIEST WAY: You can use "imapsync" to migrate/copy mail messages from old server to new server via IMAP protocol.
2. You can simply copy mail messages to new server. WARNING:

- do not copy files whose names start with 'dovecot.' It's used by Dovecot internally.
- make sure you're copying messages for same user account on old + new servers.
- make sure you're copying messages to correct mailbox on NEW server. The mailbox path on file system (/var/vmail/vmail1/<domain>/<...> by default) is stored in SQL database "vmail.mailbox".

As you can see, with solution #1, you don't need to know any technical details about old/new servers, just sync mailboxes with username/passwords.

5

Re: Importing old email while new email exists

Thanks, that's what I was looking for, I'll try those out!

6

Re: Importing old email while new email exists

So, just in case this proves useful to anyone else, I ended up using isync (or mbsync) instead of imapsync. imapsync requires two functioning IMAP servers, while I had ONE functioning IMAP server plus the Maildir dump from the old one. isync was perfect for that (even though I had to fiddle with its configuration to upload everything properly).