English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I want to send mail through using threads in ASP.NET with C#, but if any error in thread function than threads aborted, I have used try catch for this but no response, no code execute if error
try
{
// send mail code
}
catch (Exception e)
{
// write into log file
}

but no log file updated

please help me

2006-07-05 22:28:52 · 1 answers · asked by Sindhu 2 in Computers & Internet Programming & Design

1 answers

From my understanding, the thread pool has by default 25 threads(point to
note timers use the thread pool) that you can use. After all these threads
are used up the next request will wait until one of the threads becomes
free. The Pool is created the first time you

A) a timer is registered
B) you invoke the Threadpool.queueuserworkitem

To use the threadpool you need to call the Threadpool.queueuserworkitem
with a callback delegate with an Object argument that will process your
work.

System.Net.Mail.MailMessage message = new system.Net.Mail.MailMessage();
message.To.Add("luckyperson@online.microsoft.com");
message.Subject = "This is the Subject line";
message.From = new System.Net.Mail.MailAddress("From@online.microsoft.com");
message.Body = "This is the message body";
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("yoursmtphost");
smtp.Send(message);

2006-07-05 22:55:27 · answer #1 · answered by Joe_Young 6 · 5 1

fedest.com, questions and answers