This guide covers steps on how to import email messages from a cPanel generated backup into an existing email account. This is useful when the current email account has messages newer than the backup that need to be retained.
Note: We suggest performing a backup of the account prior to performing the following
The first step is to copy the backup for the account to the local server. The exact steps for this are not covered in this guide as it depends on the server configuration.
If you are using incremental/uncompressed backups, copy the
username/homedir/mail/ directory to the local server to
If you are using compressed backups, extract the tarball and then copy the
username/homedir/mail/ directory to the local server as
For each email account that will be restored, import the email from the backup directory:
doveadm import -u firstname.lastname@example.org mdbox:/home/username/mail.bak/domain.tld/user/ INBOX ALL
Ensure that the email account and path are updated to match the account you are restoring.
Repeat for any accounts that need mail imported.