login to gmail fails

Nov 15, 2009 at 9:49 PM

I try to connect to gmail imap using koolwired but I keep getting an authorization error

 

+ [Koolwired.Imap.ImapAuthenticationException] {"Authentication failed: * CAPABILITY IMAP4rev1 UNSELECT LITERAL+ IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE"} Koolwired.Imap.ImapAuthenticationException

+ [Koolwired.Imap.ImapAuthenticationException] {"Authentication failed: * CAPABILITY IMAP4rev1 UNSELECT LITERAL+ IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE"} Koolwired.Imap.ImapAuthenticationException

any idea what I should do ? (I use the correct email and password)
Thanks
Arnon

 

Nov 17, 2009 at 6:59 AM

it's a problem with the current code...

GMails sends the capability response twice for whatever reason and this library can't deal with that...

 

if you want to fix it yourself: This is what I changed in ImapAuthenticat.cs -> public void Login(string username, string password) after the switch statement...

 

            while (Connection.State == ConnectionState.Authenticating)
            {
                result = Connection.ReadLine();
                if (result.ToLower().StartsWith("* ok") || result.ToLower().Substring(7, 2) == "ok")
                    Connection.ConnectionState = ConnectionState.Open;
                else if (result.ToLower().StartsWith("* no") || result.ToLower().Substring(7, 2) == "no"
                         ||result.ToLower().StartsWith("* bad") || result.ToLower().Substring(7, 3) == "bad")
                {//bad command or wrong username (no)
                    Connection.ConnectionState = ConnectionState.Broken;
                    throw new ImapAuthenticationException("Authentication failed: " + result);
                }
            }

Nov 18, 2009 at 10:44 AM

Thanks I'll try that

 

Arnon

Apr 28, 2010 at 5:54 PM
Edited Apr 28, 2010 at 6:01 PM

This patch fixed the same problem I was having with a Rackspace IMAP server. Thanks!

 

May 26, 2010 at 6:43 PM
DieBagger wrote:

it's a problem with the current code...

GMails sends the capability response twice for whatever reason and this library can't deal with that...

 

if you want to fix it yourself: This is what I changed in ImapAuthenticat.cs -> public void Login(string username, string password) after the switch statement...

 

 

            while (Connection.State == ConnectionState.Authenticating)
            {
                result = Connection.ReadLine();
                if (result.ToLower().StartsWith("* ok") || result.ToLower().Substring(7, 2) == "ok")
                    Connection.ConnectionState = ConnectionState.Open;
                else if (result.ToLower().StartsWith("* no") || result.ToLower().Substring(7, 2) == "no"
                         ||result.ToLower().StartsWith("* bad") || result.ToLower().Substring(7, 3) == "bad")
                {//bad command or wrong username (no)
                    Connection.ConnectionState = ConnectionState.Broken;
                    throw new ImapAuthenticationException("Authentication failed: " + result);
                }
            }

 

It worked for me (using gmail)! Thanks!