Please practise the migration on a test server first, make sure you understand the whole procedure and migrate all required data.
Since new iRedMail server will install same components as old server, you can choose what data you want to migrate.
Most important data are:
msgrcpt. Quarantined emails are stored in
quarantine, it requires other 3 tables. If you don't have any quarantined emails, it's safe to delete all records in these 4 tables.
Do not restore database
mysql exported from old server, it contains SQL
usernames/passwords for Roundcube/Amavisd/iRedAPD/iRedAdmin/... used on
old server. New iRedMail server has the same SQL usernames, but different
passwords. So please do not restore it.
Since iRedMail-0.8.7, iRedMail enforces secure POP3/IMAP/SMTP connections, please update your mail client applications to use TLS connection.
TLS), or port
TLS), or port
If you want to enable smtp authentication on port
25 (again, not
recommended), please comment out Postfix parameter
smtpd_tls_auth_only = yes
in its config file
if you want to enable SMTPS (SMTP over SSL, port
465) to support
legency mail clients, please follow this tutorial:
How to enable SMTPS service.
Steps to migrate LDAP mail accounts:
Normally, LDAP data can be exported into LDIF format. Here's backup/restore procedure: Backup and Restore.
All mail accounts are stored in database
If both old and new servers are running same iRedMail version, you can simply
vmail database on old server, then import it on new server.
If old server is running an old iRedMail version, there might be some changes
in SQL structure, please read all upgrade tutorials for the old iRedMail
release, then apply SQL structure related changes to make sure old server
has same SQL structure. After you have same SQL structure on both servers,
you can simply export
vmail database on old server, then import it on new
server. Check upgrade tutorials for iRedMail.
Set correct file owner and permission of mailboxes. Default owner is
vmail, permission is
With SQL backends, you can get full maildir path of user with below SQL command:
mysql> USE vmail; mysql> SELECT CONCAT(storagebasedirectory, '/', storagenode, '/', maildir) FROM mailbox WHERE email@example.com';
homeDirectoryof mail user object. You can query with
$ ldapsearch -x -D 'cn=Manager,dc=xx,dc=xx' -b 'o=domains,dc=xx,dc=xx' -W "(firstname.lastname@example.org)" homeDirectory
mlmmj mailing list was introduced in iRedMail-0.9.8.
Mailing lists are stored in 2 places:
/var/vmail/mlmmj: it stores active mailing lists.
/var/vmail/mlmmj-archive: it stores removed mailing lists.
For mailing list accounts, they should be migrated while migrating mail accounts mentioned in steps above.
For mailing list data, you can simply copy them to new server. After copied,
the data must be owned by user/group
mlmmj:mlmmj with permission
Export those database on old server, then import them on new server.
Amavisd will read DKIM keys and sign outgoing emails. DKIM keys are stored
/var/lib/dkim by default, you can copy all keys under this directory to
new server, and make sure they have correct file owner
If you prefer generating new DKIM keys on new server, don't forget to update DNS records for mail domain names.
After migration, please recalculate mailbox quota by following this tutorial: