Ver Mensaje Individual
  #2 (permalink)  
Antiguo 16/03/2010, 09:36
Truji
 
Fecha de Ingreso: enero-2010
Mensajes: 10
Antigüedad: 14 años, 10 meses
Puntos: 0
Respuesta: Mandar Mail "smtp.gmail.com"

En este ejemplo se ve mas claro,

será porque el puerto esta bloqueado o algo asi

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Start by creating a mail message object
Dim MyMailMessage As New MailMessage()

'From requires an instance of the MailAddress type
MyMailMessage.From = New MailAddress("[email protected]")

'To is a collection of MailAddress types
MyMailMessage.To.Add("[email protected]")
MyMailMessage.Subject = "GMail Test"
MyMailMessage.Body = "This is the test text for Gmail email"

'Create the SMTPClient object and specify the SMTP GMail server
Dim SMTPServer As New SmtpClient("smtp.gmail.com")
SMTPServer.Port = 587
SMTPServer.Credentials = New System.Net.NetworkCredential("[email protected]", "password")
SMTPServer.EnableSsl = True

Try
SMTPServer.Send(MyMailMessage)
Response.Write("Email Sent")
Catch ex As SmtpException
Response.Write(ex.Message)
Response.Write(ex.StackTrace)
Response.Write(ex.StatusCode)
End Try

End Sub