Hi members
I want to send an email via asp.net and i tried this code :
Dim mail As New MailMessage("houssemmahjoubi1@gmail.com", "houssemmahjoubi1@gmail.com", "This is body", "this is subject")
mail.Subject = "Test Sending Mail"
mail.IsBodyHtml = True
Dim smtp As New SmtpClient("smtp.gmail.com", 587)
smtp.UseDefaultCredentials = True
smtp.Credentials = New System.Net.NetworkCredential("houssemmahjoubi1@gmail.com", "password")
smtp.EnableSsl = True
smtp.Send(mail)
Label1.Text = "Mail sent"
And i get this error :
System.Net.Mail.SmtpException : 'Le serveur SMTP requiert une connexion sécurisée ou le client n'était pas authentifié. La réponse du serveur était : 5.7.0 Authentication Required. Learn more at'
I tried different method always same error like this