<pre> Try Dim sb As New StringBuilder() Dim message As MailMessage = New System.Net.Mail.MailMessage("mailid@gmail.com", 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("mailid@gmail.com", "Password") smtp.EnableSsl = True message.IsBodyHtml = True smtp.Send(message) 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 End Try
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.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)