Dim sb As New StringBuilder()
Dim message As MailMessage = New System.Net.Mail.MailMessage("firstname.lastname@example.org", txtEmail.Text.Trim(), txtSubject.Text, txtMessage.Text)
Dim smtp As New SmtpClient()
smtp.Host = "smtp.gmail.com"
smtp.Port = 587
smtp.Credentials = New System.Net.NetworkCredential("email@example.com", "Password")
smtp.EnableSsl = True
message.IsBodyHtml = True
Response.Write("<script>alert ('Thanks for Contact us')</script>")
' Clear the textbox valuess
txtName.Text = ""
txtSubject.Text = ""
txtMessage.Text = ""
txtEmail.Text = ""
Catch ex As Exception
Quote:Change your settings to allow less secure apps to access your account. If you want to allow access anyway, follow these steps:
Go to the "Less secure apps" section in My Account.
Next to "Access for less secure apps," select Turn on.
If you still can't sign in to your account, the "password incorrect" error might be caused by a different reason.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)