Mailkit.Net hangs on smtpClient.ConnectAsync(), throws no exception until Task timeout

According to your comments, the following line is failing when the port used is 465:

await smtpClient.ConnectAsync(Options.SmtpServer, Options.Port, MailKit.Security.SecureSocketOptions.None);

That’s your problem. You are trying to use port 465 while also using SecureSocketOptions.None.

You need to use SecureSocketOptions.SslOnConnect with port 465.

Port 465 is the SSL-port, but you are telling MailKit to connect and treat it as if it was connecting to a plain-text port. Obviously, that won’t work.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top