+1 vote

I've set up hmailserver successfully (ports are all open).
Now, I'm trying to connect through IMAP:

string hostname = "mail.mydomain.com";
Imap client = new Imap();

This, however, throws a null reference exception. I cannot debug it any further since it is a null exception in the Limilabs library.
The same thing happens when I try with the pop3 client.

by (450 points)
It's very unlikely for Mail.dll to throw NullReferenceException.

What is the exception stack trace?
The stacktrace is the following:

   at Limilabs.Client.IMAP.ImapResponse..ctor(Encoding encoding, String tag)
   at Limilabs.Client.IMAP.Imap.__000_(String __)
   at Limilabs.Client.IMAP.Imap.ReceiveResponse(String tag)
   at Limilabs.Client.IMAP.Imap.GetServerGreeting()
   at Limilabs.Client.ClientBase.Connect(String host, Int32 port, Boolean useSSL)
   at Limilabs.Client.ClientBase.Connect(String host, Int32 port)
   at Limilabs.Client.IMAP.Imap.Connect(String host)
Can you please turn on logging:

Is this server publicly available?

Are you using .net or .net core? What OS?
Are you able to get 'Windows-1252' encoding:
Encoding.GetEncoding("windows-1252") ?


1 Answer

0 votes
Best answer

1) Make sure you are using the latest version of Mail.dll (> 3.0.20073.1408 )

2) Consider using nuget to install it, especially if you are using .net core.:
PM> Install-Package Mail.dll

This way all required dependencies (e.g. System.Text.Encoding.CodePages) will be installed correctly.

3) If for some reason you don'w want to use Nuget:

.NETStandard 2.0 version of Mail.dll requires following packages to be installed:

  • System.Security.Cryptography.Algorithms (>= 4.3.1)
  • System.Security.Cryptography.Pkcs (>= 4.5.0)
  • System.Security.Cryptography.X509Certificates (>= 4.3.2)
  • System.Security.Cryptography.Xml (>= 4.5.0)
  • System.Text.Encoding.CodePages (>= 4.5.0)

Regular .NET version requires no additional dependencies to be installed.

by (296k points)
selected by