\n
Now, click the App passwords option. Finally, you can select a Custom name for your app.
\n\nOnce the password is generated, you will have to put it in place of your real password.
\n","author":{"@type":"Person","name":"ODAOUDY"},"upvoteCount":1}}}Reputation: 49
when i try to send a mail from my asp.net web forms could not send. while trying to debugging, time out issue occur. actually it was working fine in last year. but currently it is not working.i dont know what happen this code. this is my aspx.cs code
public static void SendByMail(string responseBody, string Subject)
{
try
{
MailMessage message = new MailMessage();
message.From = new MailAddress("abc@gmail.com", "abcd.com");
message.To.Add(new MailAddress("myemail@gmail.com"));
message.Subject = Subject;
message.Body = responseBody;
message.IsBodyHtml = true;
message.Priority = MailPriority.High;
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
client.UseDefaultCredentials = false;
NetworkCredential myCreds = new NetworkCredential("abc@gmail.com", "password", "");
client.Credentials = myCreds;
client.EnableSsl = true;
client.Send(message);
}
catch //(Exception ex)
{
throw new Exception(ex.Message, ex.InnerException);
}
}
Upvotes: 0
Views: 80
Reputation: 36
Since March 2022, Google has strengthened the security of access to your account via a third-party application.
For this, you should not use your own password to log into your account, but rather generate a password via your account.
To do that, make sure that your two-step verification is on. Now, go to the "Manage your Google Account", then click the "Security" tab.
Now, click the App passwords option. Finally, you can select a Custom name for your app.
Once the password is generated, you will have to put it in place of your real password.
Upvotes: 1