. Advertisement .
..3..
. Advertisement .
..4..
How to solve the problem – unable to read data from the transport connection: net_io_connectionclosed? I have the sample detail:
SmtpClient client = new SmtpClient();
client.Host = "hostname";
client.Port = 465;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = false;
client.EnableSsl = true;
client.Credentials = new NetworkCredential("User", "Pass);
client.Send("from@hostname", "to@hostname", "Subject", "Body");
While I was running it, I found the warning message:
Unable to read data from the transport connection: net_io_connectionclosed
That is my question in my midterm exam, and it is urgent. I searched the solutions on some websites, but I didn’t get it. I may miss any line or other changes. I appreciate your assistance!
The cause: The problem is using port 465 which is clearly deprecated.
Solution: Instead of 465, you can use port 587.
Lessons that we may apply are as follows:
– STARTTLS is the only encryption protocol that the.NET SmtpClient supports. A STARTTLS response to EHLO is required if the EnableSsl option is set; otherwise, the server will raise an exception.
– Plaintext and encryption can both be used on the same port by using STARTTLS to support services. An encrypted connection would be established after switching from plaintext with the STARTTLS command. For SMTP encryption, STARTTLS has become the criterion.
This post is for anyone who came across it looking for a solution.
The username is not the username that you created when you created the sendgrid object. Find your username
We hope this helps!