client.ListMessages throws NullReferenceException: Object reference not set to an instance of an object.
See below forthe code, the exception and the log file.
The code
static void test3()
{
var client = new Pop3Client
{
Host = "mail.zxcs.nl",
Port = 995,
SecurityOptions = SecurityOptions.SSLImplicit,
UseAuthentication = true,
Username = "****************************",
Password = "****************************"
};
client.LogFileName = "aspose.log";
client.EnableLogger = true;
var connection = client.CreateConnection();
var messages = client.ListMessages(connection, Pop3ListFields.IdOnly);
}
The exception
Aspose.Email.AsposeException
HResult=0x80131500
Message=Object reference not set to an instance of an object.
Source=Aspose.Email
StackTrace:
at . (IAsyncResult )
at . ()
at Aspose.Email.Clients.EmailClient. (IAsyncResult )
at Aspose.Email.Clients.Pop3.Pop3Client. (IAsyncResult )
at Aspose.Email.Clients.Pop3.Pop3Client.ListMessages(IConnection connection, Pop3ListFields fields, Boolean closeTransaction, MailQuery query)
at Aspose.Email.Clients.Pop3.Pop3Client.ListMessages(IConnection connection, Pop3ListFields fields)
at TestMail.Program.test2() in C:\Users\HendrikRomkes\source\repos\TestMail\TestMail\Program.cs:line 51
at TestMail.Program.<Main>d__0.MoveNext() in C:\Users\HendrikRomkes\source\repos\TestMail\TestMail\Program.cs:line 12
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
NullReferenceException: Object reference not set to an instance of an object.
The logfile
-------------------------------------------------------------------------------
--- Aspose.Email for .NET [21.3.0.0] POP3 Client diagnostic log
---
--- Started: 15-4-2021 09:28:28
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
--- Aspose.Email for .NET [21.3.0.0] POP3 Client diagnostic log
---
--- Started: 15-4-2021 09:28:29
-------------------------------------------------------------------------------
Pop3 client[2|15-4-2021 09:28:29]:
Pop3 client[2|15-4-2021 09:28:29]:
15-4-2021 09:28:29
Pop3 client[2|15-4-2021 09:28:29]: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Connect to: mail.zxcs.nl:995 SecurityOptions.SSLImplicit <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Pop3 client[2|15-4-2021 09:28:29]:
15-4-2021 09:28:29
Pop3 client[2|15-4-2021 09:28:29]: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Environment version: 3.1.13 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Pop3 client[2|15-4-2021 09:28:29]:
15-4-2021 09:28:29
Pop3 client[2|15-4-2021 09:28:29]: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> OS version: Microsoft Windows NT 6.2.9200.0 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Pop3 client[2|15-4-2021 09:28:29]:
15-4-2021 09:28:29
Pop3 client[2|15-4-2021 09:28:29]: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Assembly title: Aspose.Email for .NET <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Pop3 client[2|15-4-2021 09:28:29]:
15-4-2021 09:28:29
Pop3 client[2|15-4-2021 09:28:29]: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Assembly version: 21.3.0.0 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Pop3 client[2|15-4-2021 09:28:29]:
15-4-2021 09:28:29
Pop3 client[2|15-4-2021 09:28:29]:
Pop3 client[2|15-4-2021 09:28:29]:
15-4-2021 09:28:29
Pop3 server[2|15-4-2021 09:28:30]: +OK POP3 ready
Pop3 server[2|15-4-2021 09:28:30]:
15-4-2021 09:28:30
Pop3 client[2|15-4-2021 09:28:30]: CAPA
Pop3 client[2|15-4-2021 09:28:30]:
15-4-2021 09:28:30
Pop3 server[2|15-4-2021 09:28:30]: +OK Capability list follows
Pop3 server[2|15-4-2021 09:28:30]: TOP
Pop3 server[2|15-4-2021 09:28:30]: USER
Pop3 server[2|15-4-2021 09:28:30]: SASL PLAIN LOGIN
Pop3 server[2|15-4-2021 09:28:30]: .
Pop3 server[2|15-4-2021 09:28:30]:
15-4-2021 09:28:30
Pop3 client[2|15-4-2021 09:28:30]: USER ------removed------
Pop3 client[2|15-4-2021 09:28:30]:
15-4-2021 09:28:30
Pop3 server[2|15-4-2021 09:28:30]: +OK
Pop3 server[2|15-4-2021 09:28:30]:
15-4-2021 09:28:30
Pop3 client[2|15-4-2021 09:28:30]: PASS ************
Pop3 client[2|15-4-2021 09:28:30]:
15-4-2021 09:28:30
Pop3 server[2|15-4-2021 09:28:30]: +OK Logged in.
Pop3 server[2|15-4-2021 09:28:30]:
15-4-2021 09:28:30