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'
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.
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
Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar. In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs. "Delete" is …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel.
Part 1 of this series discussed basic error handling code using VBA.