so I've been trying to set up a contact form using google's smtp server but im having the error written in the title. I've tried to look up for solutions online and I have already changed my password to a strong one, I disabled the gmail account's security, I logged in from the server's web browser onto the gmail account. Any ideas on how I can solve this?
Dim strFrom = "EMAIL@gmail.com"
Dim strTo = "RECEPIENT@EMAIL.net"
Dim MailMsg As New MailMessage(New MailAddress(strFrom.Trim()), New MailAddress(strTo))
MailMsg.BodyEncoding = Encoding.Default
MailMsg.Subject = "This is a test"
MailMsg.Body = "This is a sample message using SMTP authentication"
MailMsg.Priority = MailPriority.High
MailMsg.IsBodyHtml = True
'Smtpclient to send the mail message
Dim SmtpMail As New SmtpClient
Dim basicAuthenticationInfo As New System.Net.NetworkCredential("EMAIL@gmail.com", "PASSWORD")
SmtpMail.Host = "smtp.gmail.com"
SmtpMail.Port = "587"
SmtpMail.UseDefaultCredentials = False
SmtpMail.Credentials = basicAuthenticationInfo
SmtpMail.Send(MailMsg)