While using SendMailAsync
I am getting the following error:
An asynchronous module or handler completed while an asynchronous operation was still pending
My code :
public static async Task SendEmail(MessageContent messageContent, string emailBody)
{
SmtpClient smtpClientNoSend = new SmtpClient();
await smtpClientNoSend.SendMailAsync(mailMessage);
}
Call From Controller:
public async System.Threading.Tasks.Task<ActionResult> Register()
{
await SendEmail();
}
private void SendEmail()
{
SMTPEmail.SendEmail(msg, output.ToString());
return null;
}