I have a form that returns ActionResult that sends an email after completing the operation.
I would like to leave this email asynchronous, because it takes a lot of the time, I tried to put it in a Task using the SendMailAsync method of the SmtpClient class >, however it does not work.
Can anyone tell me what I need to do to send these emails asynchronously in asp.net mvc?
System.Threading.Tasks.Task.Run(() =>
{
var smtp = new SmtpClient();
smtpClient.SendMailAsync(message);
}