Using listmessages with Pop3Client

I am evaluating Aspose.Email File version 4.8.0 and attempting to use Pop3Client.ListMessages and getting a failure:


Aspose.Email.Pop3.Pop3Exception was caught


Message=The server returned an invalid response to the TOP command.



at . . ( [] )

at . .Send( , String , Int32 )

at . . (Int32 , Int32 )

at . . (Pop3ListFields )

at Aspose.Email.Pop3.Pop3Client.ListMessages(Boolean closeTransaction)

at Aspose.Email.Pop3.Pop3Client.ListMessages()

at Pop3Test.Program.Main(String[] args) in c:\Users\thayes\Documents\Visual Studio 2012\Projects\Tests\Pop3Test\Pop3Test\Program.cs:line 28

InnerException: System.NullReferenceException


Message=Object reference not set to an instance of an object.



at Aspose.Email.Mail.AlternateView.CreateAlternateViewFromString(String , Encoding , ContentType , TransferEncoding )

at Aspose.Email.Mail.AlternateView.CreateAlternateViewFromString(String content, ContentType contentType)

at Aspose.Email.Mail.MailMessage. ( , Boolean , AlternateView )

at Aspose.Email.Mail.MailMessage. ( , Boolean , AlternateView )

at Aspose.Email.Mail.MailMessage. ( )

at Aspose.Email.Mail.MailMessage. ( )

at Aspose.Email.Mail.MailMessage. ( , Boolean )

at Aspose.Email.Mail.MailMessage…ctor( , Boolean , Boolean )

at Aspose.Email.Mail.MailMessage. (Stream , MailMessageLoadOptions )

at Aspose.Email.Mail.MailMessage.Load(Stream stream, MailMessageLoadOptions options)

at Aspose.Email.Mail.MailMessage.Load(Stream stream)

at . . ( [] )


{“Object reference not set to an instance of an object.”}

We are trying to connect to gmail pop3 port 995, [ ](

Here is a snippet

var client = new Aspose.Email.Pop3.Pop3Client(“[ ](”, 995);

client.SecurityOptions = SecurityOptions.SSLImplicit;

client.Timeout = 60000;


var mailQuery = messageQueryBuilder.To.Contains(emailAddress);


The emailAddress and password are withheld for security reasons. Thanks in advance.


Thank you for sharing your concern with us.

Using the latest version of Aspose.Email for .NET 4.8.0, I have investigated this issue at my end and was unable to reproduce it at my end. The messages are listed properly from my Gmail account without any exception raised. Please try the following code at your end and let us know your feedback.

Sample Code:

Pop3Client popClient = new Pop3Client(“[](”,995,“”,“pasword”);

Pop3MailboxInfo mailboxInfo = popClient.GetMailboxInfo();

MailQueryBuilder builder = new MailQueryBuilder();


Pop3MessageInfoCollection messageInfoCol = popClient.ListMessages(builder.GetQuery());

foreach (Pop3MessageInfo msgInfo in messageInfoCol)


Should I try this code on your email account? If so the email account appears to be disabled.


Please use the following account information that will work for you for testing of this issue and let us know your feedback.

Sample Code:

Pop3Client popClient = new Pop3Client(“”,995,"",“visual2010”);

popClient.SecurityOptions = SecurityOptions.Auto;