+2 votes

I have one gmail account that is throwing the following error when accessing SelectInbox(), same code works fine on other gmail accounts. It was working fine on this one until today

System.ArgumentNullException: Array cannot be null.
Parameter name: bytes
at System.Text.Encoding.GetString(Byte[] bytes)

code I'm using:

Using imap As New Imap
    Try
        imap.ConnectSSL("imap.gmail.com")
        imap.UseBestLogin("email@whatever.com", "pwd")
        imap.SelectInbox()
        Dim uids As List(Of Long) = imap.Search(Flag.All)
    Catch ex As Exception
        Console.WriteLine(ex.InnerException)
    End Try
End Using
by
retagged by
Could you please turn on logging, as described here:
https://www.limilabs.com/blog/logging-in-mail-dll
Add the log output to your question (remember to remove the password). Also what is the value of ex.ToString()?
Mail.dll: 10 22:36:00 3.0.12292.1252
Mail.dll: 10 22:36:00 S: * OK Gimap ready for requests from 109.169.80.243 e10mb36013335qga
Mail.dll: 10 22:36:00 C: ce0ee330fa134302 CAPABILITY
Mail.dll: 10 22:36:00 S: * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 XYZZY SASL-IR AUTH=XOAUTH AUTH=XOAUTH2 AUTH=PLAIN AUTH=PLAIN-CLIENTTOKEN
Mail.dll: 10 22:36:00 S: ce0ee330fa134302 OK Thats all she wrote! e10mb36013335qga
Mail.dll: 10 22:36:00 C: badff42a48a84cb1 ID ("name" "Mail.dll" "version" "3.0.12292.1252" "vendor" "www.limilabs.com" "contact" "support@limilabs.com")
Mail.dll: 10 22:36:00 S: * ID ("name" "GImap" "vendor" "Google, Inc." "support-url" "http://support.google.com/mail" "remote-host" "109.169.80.243" "connection-token" "e10mb36013335qga")
Mail.dll: 10 22:36:00 S: badff42a48a84cb1 OK Success e10mb36013335qga
Mail.dll: 10 22:36:01 C: db4691a3445045a3 AUTHENTICATE PLAIN
Mail.dll: 10 22:36:01 S: +
Mail.dll: 10 22:36:01 C: [removed]
Mail.dll: 10 22:36:01 S: * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE ENABLE MOVE CONDSTORE ESEARCH
Mail.dll: 10 22:36:01 S: db4691a3445045a3 OK  Request authenticated (Success)
Mail.dll: 10 22:36:03 C: e66d02b5b83f48e3 SELECT "INBOX"
Mail.dll: 10 22:36:03 S: * BYE [OVERQUOTA] Account exceeded command or bandwidth limits.



I guess that last line explains it. is this a gmail thing?

1 Answer

0 votes

1.
I can see that you are using old version of Mail.dll.
Please update to the latest version:
https://www.limilabs.com/mail/download
You'll get correct exception message then.

2.
The root cause is of course:

* BYE [OVERQUOTA] Account exceeded command or bandwidth limits.

You'll need to resolve this, either by deleting some emails or by limiting access to this account.

There is nothing you can do about it from the code, apart from handling the exception and displaying the error message to the user or/and logging it.

Is this a gmail thing?

It's rather IMAP thing. Server can always end a connection, there is nothing you can do about it.

by (301k points)
...