Search This Blog

Thursday, September 20, 2018

G-Suits Issue - SmtpException: Unable to read data from the transport connection: net_io_connectionclosed



Common error in G-suits account for sending  SMTP mail .


When getting error :


G-Suits Issue - SmtpException: Unable to read data from the transport connection: net_io_connectionclosed


Solution : 


The most simple way to test is to try using port 587 and not 465. While some SMTP servers support TLS on 465 (and sometimes even 25), only port 587 is required to support TLS. 



 SmtpClient sm = new SmtpClient();
            sm.EnableSsl = true;
            sm.Host = "smtp.gmail.com";
            sm.Port = 587;//465;
            sm.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
            sm.UseDefaultCredentials = false;
            sm.Credentials = new NetworkCredential("email", "password");
            sm.ServicePoint.MaxIdleTime = 1;
            sm.Send(ms);
            ms.Dispose();