Sending Email SMTP Client Asynchronously

I need to send email asychronously without interrupting the calling thread, but the built in sendasync method does block the calling thread.  If I run the software I'm using with an internet connection, there is no problem, but if I disconnect the computer from the internet, the software will freeze for approximately 15 seconds before giving up the attempt to send the email.  Here is the code I'm using:

        public void Send_Error_Email(SmtpClient inputClient, MailMessage inputMessage)
            inputClient.SendCompleted += new SendCompletedEventHandler(error_SendCompleted);

            if (inputMessage.To != null)
                if (inputMessage.To.Count > 0)
                    //fix error regarding 'Mailbox unavailable'
                    inputClient.SendAsync(inputMessage, "Email");

Is there something wrong with this code?  I thought it was supposed to run on its own thread based on the MSDN description, but it does not do so. Thanks for any help you can offer.
Who is Participating?
l2BravoConnect With a Mentor Author Commented:
Nobody answered the question, but I found a solution by simply creating my own thread to send the email.  While the documentation seems to indicate the SendAsync method does this automatically, I assumed I did not have to.  But, because the documentation does not seem to be correct (or I'm reading it wrong), I created a simple thread to send the email and close after that action is completed, with a timeout of 10 seconds on the Send method.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.