Resolver Unable to read data from the transport connection: net_io_connectionclosed
20220704 12:30:32 : Application Mail Error: System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed.
at System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte[] buffer, Int32 offset, Int32 read, Boolean readLine)
at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine)
at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller)
at System.Net.Mail.CheckCommand.Send(SmtpConnection conn, String& response)
at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, MailAddress from, Boolean allowUnicode)
at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, Boolean allowUnicode, SmtpFailedRecipientException& exception)
at System.Net.Mail.SmtpClient.Send(MailMessage message)
--- End of inner exception stack trace ---
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at Models.Funciones.enviarEmailRegistroActivacion(SegmentoModel _model) in C:\www\www.misitio.com\Models\Funciones.cs:line 166
Solución.
{
var bodyMail="";MailAddress a = new MailAddress(_model.EMAIL);MailAddress de = new MailAddress(p_FromMail);MailMessage message = new MailMessage(de, a);if (p_bcc_email.Length > 0){MailAddress bcc = new MailAddress(p_bcc_email);message.Bcc.Add(bcc);}message.IsBodyHtml = true;message.Subject = "Activación de cuenta para ingreso";bodyMail = "<p>Hola " + _model.NOMBRE + ".</p>";bodyMail += "Recibimos sus datos correctamente.<br/>";bodyMail += "<p>Atentamente,</p>";message.Body = bodyMail;// Use the application or machine configuration to get the// host, port, and credentials.//Allow TLS 1.0, 1.1 and 1.2ServicePointManager.SecurityProtocol = (SecurityProtocolType)(0xc0 | 0x300 | 0xc00);SmtpClient client = new SmtpClient();//client.EnableSsl=true;try{client.Send(message);}catch (Exception ex){Funciones.GrabaArchivo(ArchivoLog, "Application Mail Error: " + ex.ToString(), true);}
20220704 13:01:17 : Application Mail Error: System.Net.Mail.SmtpException: Error in processing. The server response was: 5.7.3 STARTTLS is required to send mail [MN2PR15CA0060.namprd15.prod.outlook.com]
at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response)
at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, MailAddress from, Boolean allowUnicode)
at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, Boolean allowUnicode, SmtpFailedRecipientException& exception)
at System.Net.Mail.SmtpClient.Send(MailMessage message)
No hay comentarios.:
Publicar un comentario