hello,
how can I move all emails from one physical server to another? which directories do I have to copy??
many thanks
I would copy the full backup from /backup to the new server using scp.
I just create a Hestia backapp and all my emails are migrated with all the settings.
Are there other options?
imapsync
There are 3 parts:
1.- Mail accounts
Mail accounts (users, passwords, exim conf, certificates, etc.) are located here
/home/USER/conf/mail/DOMAIN/
2.- emails
emails are located here:
/home/USER/mail/DOMAIN/ACCOUNT/
3.- Exim and dovecot conf for domains
Exim conf for domains, is basically symbolic links pointing to the right conf dir.
/etc/exim4/domains/
Dovecot conf for domains is located here:
/etc/dovecot/conf.d/domains/
As @cloudknight and @bestperson advised, making an Hestia backup and restore it on destination server should be the best and easiest approach.
If you only want emails, you can use doveadm
tool. For example, to backup all emails of [email protected]
.
mkdir -p /tmp/backup_mails/[email protected]
chgrp -R mail /tmp/backup_mails/
chmod -R 770 /tmp/backup_mails/
doveadm backup -u [email protected] maildir:/tmp/backup_mails/[email protected]/
Now all the mails for that account are in dir /tmp/backup_mails/[email protected]/
so you can tar and compress it and send it to destination server.
To restore those emails, untar and decompress the backup file and then delete all the mails for the account and once done restore them.
Warning: This command will REMOVE ALL MAILS of [email protected]
doveadm expunge -u [email protected] mailbox '*' all
Now restore the backup:
doveadm -v import -u [email protected] -s maildir:/path/to/untar/backup/[email protected] "" ALL
Note: the account [email protected]
must be already created in destination server.
great!! thanks!