An asynchronous module or handler completed while an asynchronous operation was still pending
I ended up reworking the way my Async email is sent with the following:
public void SendAsyncEmail(MailMessage message) { var client = new SmtpClient("mail.hover.com", 587) { Credentials = new NetworkCredential("admin@site.com", "Covert00!"), EnableSsl = false }; client.SendCompleted += (sender, error) => { if (error.Error != null) { // TODO: get this working throw new WarningException("Email Failed to send."); } client.Dispose(); message.Dispose(); }; ThreadPool.QueueUserWorkItem(o => client.SendAsync(message, Tuple.Create(client, message))); }
Note that this is a temporary solution, and that the correct way (it seems) to handle emailing is to use some kind of queue service paired with a worker role or other windows service to pop the messages.