Additionally, some servers don't like plaintext connections, so --ssl1 and --ssl2 flags can be handy:

./imapsync --nosyncacls --syncinternaldates --ssl1 --ssl2 --host1 servername1 --user1...