Thursday, 6 June 2013

[Error resolved]: Unable to read data from the transport connection: net_io_connectionclosed

 I was testing a report generator that sends reports to associated clients. Other parts of the project worked okay, but at runtime, it threw an exception with a message "Failure sending email" and the inner exception message "Unable to read data from the transport connection: net_io_connectionclosed", neither of which did not help much.

 After searching through the web and asking around people, I finally realised that, because the project was built few years ago and had the old SMTP server configuration passed into it, it was failing to connect to the server to send the emails. Changing the SMTP server sorted out the problem straight away in my case, but there may be other problems responsible for the same exception being thrown. Sender email address and its credentials must be correctly set (for example, if you are using gmail's SMTP server, you should set the username and password to send as the particular user), or use default credential (Property for SmtpClient).



1 comment: