In this docker-compose example, we will:
- Create a mail account
test@example.com - Setup the web email client for
test@example.com - Login to web email client and send a few emails to
test@example.com - Backup
test@example.comusingimap-backup
To start all services, run:
docker-compose upThe following services are now running:
step-caas our self-signed CA, to sign self-signed certs fordocker-mailserverdocker-mailserveras mail serversnappymailas web email clientimap-backupas IMAP backup client
First, setup a docker-mailserver email account test@example.com and password test:
docker-compose exec docker-mailserver setup email add test@example.comOnce done, wait for about 10s and docker-mailserver will automatically setup the email account.
Login to snappymail Admin Panel at http://localhost:8888/?admin. Username is admin. Get the Admin Panel password by running:
docker-compose exec snappymail cat /var/lib/snappymail/_data_/_default_/admin_password.txtIn snappymail Admin Panel, click Domains, and click + Add Domain button:
- In
Namebox, enterexample.com - Click
IMAPtab:- In
Serverbox, enterimap.example.com - In
Securedropdown, selectSSL/TLS - In
Port, enter993 - In
Timeout, enter300 - Uncheck
Use short login - Uncheck
Require verification of SSL certificate
- In
- Click
SMTPtab:- In
Serverbox, entersmtp.example.com - In
Securedropdown, selectSSL/TLS - In
Port, enter465 - In
Timeout, enter60 - Uncheck
Use short login - Check
Use authentication - Check
Use login as sender - Uncheck
Require verification of SSL certificate
- In
- At bottom right, click
Testbutton:- Username:
test@example.com - Password:
test - Click on
Testbutton. Tests should be green. ClickSavebutton
- Username:
Login to snappymail at http://localhost:8888, using username test@example.com and password test.
Send a few emails to yourself at test@example.com.
imap-backup config should have already been setup for test@example.com as part of docker-compose up.
View imap-backup config:
docker-compose exec imap-backup cat /root/.imap-backup/config.jsonNow, run the backup (should take only 1 second):
docker-compose exec imap-backup imap-backup backupCheck backup integrity (not available on <= 9.2.0):
docker-compose exec imap-backup imap-backup local checkPrint backup stats. You should see the correct number of emails for INBOX and Sent:
docker-compose exec imap-backup imap-backup stats test@example.comList backup files:
docker-compose exec imap-backup ls -alR /root/.imap-backupThe backup is successful.
In snappymail, delete all emails in Inbox and Sent folders. Delete emails end up in the Trash folder.
Restore all emails from the backup to the IMAP server (should take only 1 second):
docker-compose exec imap-backup imap-backup restore test@example.comOptional: To see verbose logs, use the --verbose flag:
docker-compose exec imap-backup imap-backup restore test@example.com --verboseSee that all emails of Inbox and Sent folders are restored. The Trash folder remains with previously deleted emails.