SmtpMail timeout
-
Hi all! Here is my problem: I am developing a Windows service written in C#. The work of this service is to send an alert by mail when the total memory of the OS is too high for example. I'm using the System.Web.Mail namespace to send a mail and everything is ok. I put this piece of code in a thread to make my application more reliable, like that: ' the code for sending mail is in the ThreadLoop method of the Job class Thread jobThread = new Thread(new ThreadStart(current_job.ThreadLoop)); jobThread.Start(); ' wait until the job is done or the timeout is reached bool noTimeout = current_job.Mre.WaitOne(30*1000, false); ' stop the thread... jobThread.Abort(); Ok. My problem occured when there is a big file attached to the mail, and the timeout is reached. The method Abort() does not quit the thread until the entire mail is sent... And I cannot add a timeout to the System.Web.Mail.SmtpMail.Send method, then I am stuck. :confused: Is there a way to force the termination of a thread? Thanks. ;)