Take the 2-minute tour ×  I am trying to send SMTP email from my
vb.net form application. When applying this code, I get the
error below. What am I doing wrong?   Imports System.Net.Mail
Public Class Form1              Dim SmtpServer As New
SmtpClient()             Dim mail As New MailMessage()
SmtpServer.Credentials = New  _
Net.NetworkCredential("myemail@gmail.com", "mypassword")
SmtpServer.Port = 587             SmtpServer.Host =
"smtp.gmail.com"             mail = New MailMessage()
mail.From = New MailAddress("myemail@gmail.com")
mail.Subject = "Test Mail"             mail.Body = "This is for
testing SMTP mail from GMAIL"             MsgBox("mail send")
Catch ex As Exception         End Try     End Sub End Class
Error Message  share|improve this question add comment  2
Answers  See if this helps; Add  SmtpServer.EnableSSL= true
share|improve this answer add comment  I know this was last year
but I thought I should publish the answer a