Skip to content

Instantly share code, notes, and snippets.

@devidw
Last active June 16, 2022 10:24
Show Gist options
  • Save devidw/0e9c2b100441a1491111a46f1cfee679 to your computer and use it in GitHub Desktop.
Save devidw/0e9c2b100441a1491111a46f1cfee679 to your computer and use it in GitHub Desktop.
How to restore emails from Plesk server backup on macOS

Plesk server backup to .mbox for macOS import

Here is how to get a single importable mailbox out of a complete Plesk server backup.

  1. Download the backup from the remote Plesk server to your local machine

  2. Unarchive the downloaded backup_*.tar file

  3. Look for backup_domainmail_*.tzst inside the extracted directory and unarchive it using p7zip

    Starting from Plesk Obsidian 18.0.40, GZIP compression used in the Plesk backups has been replaced with ZSTD compression to improve performance for backup and restore operations.
    1. https://github.com/jinfeihan57/p7zip#install-cli

      /path/to/your/bin/7z x /path/to/your/backup_domainmail_*.tzst
    2. Unarchive the extracted file (it still is compressed as a .tar file)

  4. Locate the desired mailuser subdirectory inside the extracted archive and see the Maildir directory

    1. Plesk uses Dovecot mail server, which stores mails in the Maildir format

  5. Convert the Maildir to a mbox file, since macOS Mail.app only supports mbox files (we will use a python package for this)

    1. https://pypi.org/project/maildir2mbox/

      python -m maildir2mbox /path/to/your/Maildir /path/to/your/converted.mbox
  6. Import the converted.mbox file into your Mail.app, importing locally before putting it on the remote server is probably a good idea


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment