send email by vb.net

  • Thread starter Thread starter fsze88
  • Start date Start date
F

fsze88

Guest
I just try to email by vb.net ,

Try
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()

' SmtpServer.UseDefaultCredentials = True

SmtpServer.Port = 587
SmtpServer.Host = "smtp.gmail.com"
SmtpServer.Credentials = New Net.NetworkCredential("fsze88@gmail.com", "???")
SmtpServer.EnableSsl = True

mail = New MailMessage()
mail.From = New MailAddress("fsze88@gmail.com")
mail.To.Add("fsze88@hotmail.com")
mail.Subject = "Test Mail"
mail.Body = "This is for testing SMTP mail from Hotmail"
SmtpServer.Send(mail)
MsgBox("mail send")
Catch ex As Exception
MsgBox(ex.ToString)
End Try


but, it give me an error "The SMTP server requires a secure connection or the client was not authenticated"

1151232.jpg

Any one can help me to solve it out?


Thank you very much

fsze88



fsze88

Continue reading...
 
Back
Top