"Object reference no set to an instance of an object" in method MessageObjectPeek

Dec 2, 2010 at 9:07 PM

Hi all,

I am trying to use the Inbox.Fetch.MessageObjectPeek() method in order to get a message without setting the seen flag but it fails with an exception "Object reference no set to an instance of an object".

I looked in the code and the problem occurs in the ActiveUp.Net.Mail.Fetch.MessageStringPeek() method. The ServerCapabilities string of the IMAP4Client is null;

I see it is supposed to be initialized in Connect method. of Imap4Client but it is not.

I am using gmail.

Apr 23, 2011 at 3:40 AM

I had the same issue as you, the easy fix is to set the ServerCapabilities string manually after you successfully connect:

Imap4Client client = new Imap4Client();
client.ConnectSsl("imap.gmail.com", 993);            
client.LoginFast("username@gmail.com", "password");

// need to set the servercapabilities manually
client.ServerCapabilities = client.Command("capability");