http://vb.net-informations.com/commu..._smtp_mail.htm
Working on simple program that sends emails.
This used to work.
Error: Unable to read data from transport connection.
Any ideas?
Working on simple program that sends emails.
This used to work.
Error: Unable to read data from transport connection.
Any ideas?
Code:
Try
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()
SmtpServer.EnableSsl = True
SmtpServer.Credentials = New System.Net.NetworkCredential("XXX@gmail.com", "XXX")
'SmtpServer.Port = 587
SmtpServer.Port = 465
SmtpServer.Host = "smtp.gmail.com"
mail = New MailMessage()
mail.From = New MailAddress("XXX@gmail.com")
mail.To.Add("XXXXXXXX@hotmail.com")
mail.Subject = "Subj"
mail.Body = "Body"
SmtpServer.Send(mail)
MsgBox("mail send")
Catch ex As Exception
MsgBox(ex.ToString)
End Try