hi
i m working in asp.net with c#. in my application i want to send notification to administrator about their password expiration. i tried thread for this. It works fine when i give time interval upto 20min. but if i make thread to sleep for an hour it is not working. i dont know how to do this...
can anyone help me to solve this problem...
here is my code...
CODE
public void fn()
{
MailMessage mm = new MailMessage();
while (true)
{
mm.From = new System.Net.Mail.MailAddress("pwdreset@tcs.com");
mm.To.Add("administrator@book.com");
mm.IsBodyHtml = true;
mm.Body += "Dear administrator, <br><br>";
mm.Body += "You have only 7 days to reset your password.";
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(host, 25);
client.Send(mm);
[b]Thread.Sleep(TimeSpan.FromHours(1));[/b]
}
}
public void note()
{
Thread th;
ThreadStart thstart = new ThreadStart(fn);
th = new Thread(thstart);
th.Start();
}