We are trying to migrate from Google Apps to Zimbra, but imapsync exits with the following error:
Can not open imap connection on [imap.gmail.com] with user [xxx.xxx@companyname.com]:

We have successfully migrated from MDaemon to Zimbra with imapsync. I have tried getting a solution from various forums, have upgraded imapsync and IMAPClient as suugested on their website for Gmail support..... still no luck.

Firewall is not blocking outbound connections, I can telnet to port 993 and run command line IMAP commands on google apps domain.

Kindly help me resolving it.

imapsync error:

$RCSfile: imapsync,v $ $Revision: 1.286 $ $Date: 2009/07/24 15:53:04 $
Here is a [linux] system (Linux mail.zimbradomain.com 2.6.18-128.1.14.el5 #1 SMP Wed Jun 17 06:38:05 EDT 2009 x86_64)
with perl 5.8.8
Mail::IMAPClient 3.19
IO::Socket 1.29
Digest::MD5 2.36
and the module Mail::IMAPClient version used here is 3.19
Command line used:
/usr/bin/imapsync --host1 imap.gmail.com --ssl1 --user1 xxx@companyname.com --password1 MASKED --host2 mail.zimbradomain.com --user2 xxx.xxx@zimbradomain.com --password2 MASKED --authmech1 LOGIN --authmech2 PLAIN --syncinternaldates --subscribe --nosyncacls
Turned ON syncinternaldates, will set the internal dates (arrival dates) on host2 same as host1.
Will try to use LOGIN authentication on host1
Will try to use PLAIN authentication on host2
From imap server [imap.gmail.com] port [993] user [xxx@companyname.com]
To imap server [mail.zimbardomain.com] port [143] user [xxx.xxx@zimbradomain.com]
Can not open imap connection on [imap.gmail.com] with user [xxx@companyname.com]: