title: How to Send Mail Async
body: <p>I am running into an issue when trying to send an Email Async, I found out a no of post on Stackoverflow but none of them was helpful. I have following block of code</p>
  
  <pre><code>public class EmailService : IIdentityMessageService
  {
      public Task SendAsync(IdentityMessage message)
      {
          // Plug in your email service here to send an email.
  
          var mailMessage = new MailMessage
              ("me@example.com", message.Destination, message.Subject, message.Body);
  
          mailMessage.IsBodyHtml = true;
  
          var client = new SmtpClient();
  
          client.SendCompleted += (s, e) =&gt; client.Dispose();
          client.SendAsync(mailMessage,null);
          return Task.FromResult(0);
      }
  }
  </code></pre>
  
  <p>I got an email but getting an exception when this block of code run</p>
  
  <pre><code>an asynchronous module or handler completed while an asynchronous operation was still pending.
  </code></pre>
  
  <p>Any suggestion?</p>