So I have been trying to migrate some test users from our old IMAP setup (using Dovecot) to Zimbra, it seems imapsync isn't able to pull all the folders so I have to do things like --folderrec, etc. Here is the command line:

-=-
./imapsync --host1 mail.domain.tld --user1 $username --password1 '' --host2 zimbra.domain.tld --user2 $username --password2 '' --port1 993 --ssl1 --authmech1 PLAIN --authmech2 PLAIN --ssl2 --port2 993 --noauthmd5 --exclude '#shared*' --nofoldersizes --folder INBOX --subscribe_all --useuid --delete2
-=-

The initial sync for the most part works fine (except for the missing folders which I fill in on subsequent runs, but when I do, it spits out this:

-=-
CACHE h1 h2: 19135 files
Host2 folder INBOX selected: 19135 messages, duplicates: 0
Host2 flags msg INBOX/1257 could not add flags [$Forwarded $Label2 \Answered \Seen]: * BYE zimbra.domain.tld Zimbra IMAP4rev1 server closing connection (2x); Unable to connect to zimbra.domain.tld: IO::Socket::SSL: SSL connect attempt failed because of handshake problemserror:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure
-=-

Basically imapsync is unable to add flags to a migrated message so Zimbra then drops the IMAP connection, and I get three pages of SSL handshake and IMAP errors as it no longer has a connection.

This is really slowing down the migration of users, I even tried using imapsync v1.525 from git and it still has the same issue.

Ideas? (thanks in advance)