You can use Imapx Libraries.Using these libraries worked for me.The best one in IMAP i believe.
http://imapx.codeplex.com/[
^]
If you are using these type of dlls and connecting to Gmail server then may be your organization firewall is blocking the inbound and outbound calls.This might be also because of your proxy settings.Recommends you to send a network support ticket in your organization:)