'facing problem while set time out for gmail otp in c# asp.net

MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient();

mail.From = new MailAddress("[email protected]");
mail.To.Add("[email protected]");
mail.Subject = "Verify your account";
mail.Body = "Your OTP for your account verification is "+OTP.ToString()+". Enter your OTP in verification window.";
mail.IsBodyHtml = true;

SmtpServer.UseDefaultCredentials = false;
   
SmtpServer.Send(mail);

errmsgShow.Text = "Mail sent";


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source