I building a web application in ASP.NET 3.5 and C#. I have a method in my project which sends emails to the users. But for some reason the smtp send method is taking 3 to 4 seconds to execute:
SmtpClient smtp = new SmtpClient();
smtp.Send(msg);-----> This is the line of code which takes 3 to 4 seconds to execute
What could be the reasons behind this delay?
You can always use the .SendAsync() method. This way, it will send the smtp request and won’t wait for it’s response! If you don’t need the bool output of the .Send() method, problem solved! =)