I read your article How to send email with attachment in ASP.Net.
I am trying to implement by writing the same code as per given in the article.
It is showing me the error
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required. Learn more at
To fix this issue i saw your article
By following this article i click in this link
https://www.google.com/settings/security/lesssecureapps
When I open this page there is no link found to update
You need to modify the Less Secure Apps setting and Turn On access to Less Secure Apps as shown below.
Less Secure App access not found
This setting is no longer available
how to get solution plz. Here is code
using (MailMessage mm = new MailMessage(txtEmail.Text, txtTo.Text))
{
mm.Subject = txtSubject.Text;
mm.Body = txtBody.Text;
if (fuAttachment.HasFile)
{
string FileName = Path.GetFileName(fuAttachment.PostedFile.FileName);
mm.Attachments.Add(new Attachment(fuAttachment.PostedFile.InputStream, FileName));
}
mm.IsBodyHtml = false;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
NetworkCredential NetworkCred = new NetworkCredential(txtEmail.Text, txtPassword.Text);
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mm);
ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Email sent.');", true);
}
I want to implement same email system as aspsnippet email system is working. plz guide how to fix it?