try
{
MailMessage mail = new MailMessage();
mail.To.Add(UserName.Text);
mail.From = new MailAddress("shammus672@gmail.com");
mail.Subject = "Varificarion Code";
string Body = "Hello";
mail.Body = Body;
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new System.Net.NetworkCredential("shammus762@gmail.com", "shammus123");// Enter senders User name and password
smtp.EnableSsl = true;
smtp.Send(mail);
return true;
}
catch (Exception ex)
{
string str = ex.ToString();
return false;
}
Exception: "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at"
i want to send varification mail to user.