this is my code it was running without errors but suddenly an exception appears The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.
Dim smtpserver As New SmtpClient()
Dim mail As New MailMessage()
smtpserver.Credentials = New Net.NetworkCredential("[email protected]", "mypass")
smtpserver.Host = "smtp.gmail.com"
smtpserver.Port = "587"
mail = New MailMessage
mail.From = New MailAddress("[email protected]")
mail.To.Add(Form2.TextBox1.Text)
mail.Subject = "EagleEyes"
mail.Body = "EagleEyes has detected a movement!"
If emailphoto Then
Dim attach As New Attachment("D:\hi" & sm & ".jpg")
mail.Attachments.Add(attach)
End If
smtpserver.EnableSsl = True
smtpserver.UseDefaultCredentials = False
' Try1
smtpserver.Send(mail)
'Catch ex As SmtpException
'MsgBox("Error Connection!" & ex.Message)
'End Try
sm += 1