In this demo, we will demonstrate the three most common sync cases, IMAP to Maildir, Maildir to IMAP, and IMAP to IMAP.
- Create email accounts
test@example.com,test2@example.com, andtest3@example.com - Setup the web email client
- Login to web email client and send a few emails to
test@example.com - Demo: Sync IMAP to Maildir (
test@example.comto a local Maildir/mail) - Demo: Sync Maildir to IMAP (local Maildir
/mailtotest2@example.com) - Demo: Sync IMAP to IMAP (
test@example.comtotest3@example.com)
To start all services, run:
docker-compose upThe following services are now running:
step-caas our self-signed CA to sign self-signed certs formail.example.comused bydocker-mailserverdocker-mailserveras mail serversnappymailas web email clientisyncas IMAP sync client
First, in docker-mailserver container, setup three email accounts with password test.
echo 'test' | docker exec -i $( docker-compose ps -q docker-mailserver ) setup email add test@example.com
echo 'test' | docker exec -i $( docker-compose ps -q docker-mailserver ) setup email add test2@example.com
echo 'test' | docker exec -i $( docker-compose ps -q docker-mailserver ) setup email add test3@example.comThen, confirm all accounts are added. You should see three accounts:
docker-compose exec docker-mailserver setup email listLogin 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.
In this step, we will sync test@example.com to a local Maildir in /mail in a docker container.
Self-signed cert of IMAP server imap.example.com should have been created by the container entrypoint. To view self-signed cert:
docker-compose exec isync-imap-to-maildir cat /imap.example.com.pem | openssl x509 -text/mbsyncrc should have been created by the container entrypoint. To view /mbsyncrc config:
docker-compose exec isync-imap-to-maildir cat /mbsyncrcNow, run the sync (should take only 1 second):
docker-compose exec isync-imap-to-maildir /syncTo list synced files in /mail:
docker-compose exec isync-imap-to-maildir find /mailIf you see something like the following, the sync was successful:
/mail
/mail/Trash
/mail/Trash/.uidvalidity
/mail/Trash/.mbsyncstate
/mail/Trash/tmp
/mail/Trash/cur
/mail/Trash/new
/mail/Sent
/mail/Sent/.uidvalidity
/mail/Sent/.mbsyncstate
/mail/Sent/tmp
/mail/Sent/cur
/mail/Sent/cur/1681553239.33_6.436d48e6cbdf,U=3:2,S
/mail/Sent/cur/1681553239.33_4.436d48e6cbdf,U=1:2,S
/mail/Sent/cur/1681553239.33_5.436d48e6cbdf,U=2:2,S
/mail/Sent/new
/mail/INBOX
/mail/INBOX/.uidvalidity
/mail/INBOX/.mbsyncstate
/mail/INBOX/tmp
/mail/INBOX/cur
/mail/INBOX/new
/mail/INBOX/new/1681553239.33_3.436d48e6cbdf,U=3:2,
/mail/INBOX/new/1681553239.33_2.436d48e6cbdf,U=2:2,
/mail/INBOX/new/1681553239.33_1.436d48e6cbdf,U=1:2,
/mail/Drafts
/mail/Drafts/.uidvalidity
/mail/Drafts/.mbsyncstate
/mail/Drafts/tmp
/mail/Drafts/cur
/mail/Drafts/new
/mail/Junk
/mail/Junk/.uidvalidity
/mail/Junk/.mbsyncstate
/mail/Junk/tmp
/mail/Junk/cur
/mail/Junk/newIn this step, we will sync the Maildir folder /mail to test2@example.com.
First, create a fresh Maildir /mail in this container based on the previous container's Maildir /mail:
docker exec $( docker-compose ps -q isync-imap-to-maildir ) tar -C /mail -cvf - . --exclude=.mbsyncstate --exclude=.uidvalidity | docker exec -i $( docker-compose ps -q isync-maildir-to-imap ) tar -C /mail -xvf -Self-signed cert of IMAP server imap.example.com should have been created by the container entrypoint. To view self-signed cert:
docker-compose exec isync-maildir-to-imap cat /imap.example.com.pem | openssl x509 -text/mbsyncrc should have been created by the container entrypoint. To view /mbsyncrc config:
docker-compose exec isync-maildir-to-imap cat /mbsyncrcRun the sync (should take only 1 second):
docker-compose exec isync-maildir-to-imap /syncFinally, in Snappymail at http://localhost:8888, login to test2@example.com. If you see emails present in INBOX and SENT, the sync was successful.
In this step, we will sync test@example.com to test3@example.com.
Self-signed cert of IMAP server imap.example.com should have been created by the container entrypoint. To view self-signed cert:
docker-compose exec isync-imap-to-imap cat /imap.example.com.pem | openssl x509 -text/mbsyncrc should have been created by the container entrypoint. To view /mbsyncrc config:
docker-compose exec isync-imap-to-imap cat /mbsyncrcRun the sync (should take only 1 second):
docker-compose exec isync-imap-to-imap /syncFinally, in Snappymail at http://localhost:8888, login to test3@example.com. If you see emails present in INBOX and SENT, the sync was successful.