Hello!
I have strange issue and maybe someone here can help me. I'm using QuickSSL SSL certificate for handling secure connections to my SmaterMail.Sending e-mails usingMS Outlooks works but when I try to send email using simple C# code:
//create the mail message
MailMessage mail = new MailMessage("from", "to");
//set the content
mail.Subject = "This is an email";
mail.Body = "this is the body content of the email.";
SmtpClient smtp = new SmtpClient("ssl.myhost.com", 465);
smtp.Credentials = new NetworkCredential("username", "password");
smtp.EnableSsl = true;
smtp.Send(mail);
I'm getting timeot and in SmarterMail logs I have:
12:59:36 [ my IP ][17198118] Exception negotiating SSL certificate: System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[ buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[ buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[ buffer, Int32 offset, Int32 size)
at System.Net.FixedSizeReader.ReadPacket(Byte[ buffer, Int32 offset, Int32 count)
at System.Net.Security.SslState.StartReceiveBlob(Byte[ buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[ buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslStream.AuthenticateAsServer(X509Certificate serverCertificate)
at TcpServerLib.Pooled.PooledTcpItem.ConvertToSSL(SSLSetting setting)
at TcpServerLib.Pooled.PooledTcpServer.AcceptConnection(IAsyncResult res)
Does anyone have any idea how to fix this?
Thanks in advance