I want to use System.Net.Mail.SendAync in an ASP.NET MVC2 application. I see that it throws an InvalidOperationException if there is already a SendAsync call in progress. Does this mean only one SendAsync is allowed per host, or per thread? For example, if I simultaneously have 2 web users from 2 different remote hosts, can each use SendAsync at the same time?
One instance of SmtpClient can only run one asynchronous call at a time. You have to create several clients if you want to run several asynchronous calls.
As different threads have their own instance of SmtpClient, they don't collide.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With