none
Enviar correo desde VB 2015

    Debate general

  • Buen dia, no he podido enviar correso desde visual, aparese el siguiente error

    System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 65.55.163.152:587
       at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
       at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
       --- End of inner exception stack trace ---
       at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6)
       at System.Net.PooledStream.Activate(Object owningObject, Boolean async, GeneralAsyncDelegate asyncCallback)
       at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback)
       at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout)
       at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)
       at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint)
       at System.Net.Mail.SmtpClient.GetConnection()
       at System.Net.Mail.SmtpClient.Send(MailMessage message)
       --- End of inner exception stack trace ---
       at System.Net.Mail.SmtpClient.Send(MailMessage message)
       at mail.Form1.Button1_Click(Object sender, EventArgs e) in c:\users\jjimene1\documents\visual studio 2015\Projects\mail\mail\Form1.vb:line 22

    El fuente.

     Try
                correo.To.Clear()
                correo.Body = ""
                correo.Subject = ""
                correo.Body = "msjj"
                correo.IsBodyHtml = True
                correo.To.Add(Trim("correo@destino.com"))

                correo.From = New MailAddress("correo@hotmail.com")
                enviar.Credentials = New Net.NetworkCredential("correo@hotmail.com", "password")

                enviar.Host = "smtp-mail.outlook.com"  ' "smtp.gmail.com"
                enviar.Port = 587
                enviar.EnableSsl = True

                enviar.Send(correo)

            Catch ex As Exception
                MessageBox.Show(ex.ToString)
            End Try

    jueves, 8 de septiembre de 2016 15:07

Todas las respuestas