We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

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

HResult=-2146233088

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

Source=Aspose.Email

StackTrace:

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

HResult=-2147467261

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

Source=Aspose.Email

StackTrace:

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 . . ( [] )

InnerException:

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

We are trying to connect to gmail pop3 port 995, [pop.gmail.com ](http://pop.gmail.com/).

Here is a snippet

var client = new Aspose.Email.Pop3.Pop3Client(“[pop.gmail.com ](http://pop.gmail.com/)”, 995);

client.SecurityOptions = SecurityOptions.SSLImplicit;

client.Timeout = 60000;

client.Connect(true);

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

client.ListMessages(mailQuery);

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

Hi,

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(“pop.gmail.com”,995,“email@gmail.com”,“pasword”);


Pop3MailboxInfo mailboxInfo = popClient.GetMailboxInfo();

MailQueryBuilder builder = new MailQueryBuilder();

builder.To.Contains("kashif.iqbal.aspose@gmail.com");

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

foreach (Pop3MessageInfo msgInfo in messageInfoCol)

Console.WriteLine(msgInfo.Subject);

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

Hi,

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(“pop.gmail.com”,995,"jasminexyz12345@gmail.com",“visual2010”);

popClient.SecurityOptions = SecurityOptions.Auto;