Here is the code I have to send the email:
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Try
Dim SmtpServer As New SmtpClient
SmtpServer.EnableSsl = True
Dim mail As New MailMessage
SmtpServer.Credentials = New Net.NetworkCredential("Frrizzeh@gmail.com", "Password here")
SmtpServer.Port = "587"
SmtpServer.Host = "smtp.gmail.com"
mail = New MailMessage
mail.From = New MailAddress("Frrizzeh@gmail.com")
mail.To.Add("Frrizzeh@gmail.com")
mail.Subject = TextBox1.Text
mail.Body = TextBox2.Text
SmtpServer.Send(mail)
Catch ex As Exception
MsgBox(ex.Message)
End Try
However when I run the program it just returns this error:
The SMTP server requires a secure connection or the client was not authenticated.
The server server response was: 5.5.1 Authentication required.
Any ideas where I am going wrong?