1
I have a return form Actionresult who sends an email after completing the operation.
I would like to leave this asynchronous email, because it takes a lot of time, I tried to put in a Task using the method Sendmailasync class Smtpclient, yet it doesn’t work.
Someone could tell me what I need to do to send these emails asynchronously on Asp.net mvc?
System.Threading.Tasks.Task.Run(() =>
{
var smtp = new SmtpClient();
smtpClient.SendMailAsync(message);
}
I already have a generic class, my problem is that it does not send asynchronously.
– Zica
then put the method of sending email in a generic way in your application too, change it as your need (you will probably need to change the model I created) and call in your controller (or in the correct part of your application) that will work
– Ayrton Giffoni
I edited my answer to stay in a more simplified way
– Ayrton Giffoni