Hi revathip,
As we know the WebServer IIS is continuously running, we can add a timer in the application and the timer can manage all these activities.
For this we have to make use of Global.asax file.
Global.asax
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
System.Timers.Timer timer = new System.Timers.Timer();
// Set the Interval to 7 Days (604800000 milliseconds).
timer.Interval = ((((7*24)*60)*60)*1000);
timer.AutoReset = true;
timer.Elapsed += new System.Timers.ElapsedEventHandler(TimerElapsed);
timer.Enabled = true;
}
public void TimerElapsed(object source, System.Timers.ElapsedEventArgs e)
{
// Instanciate the Mail class.
ScheduleMail scheduleMail = new ScheduleMail();
// Call the send mail method.
scheduleMail.SendScheduleMail();
}
ScheduleMail.cs
public class ScheduleMail
{
public ScheduleMail()
{
//
// TODO: Add constructor logic here
//
}
public void SendScheduleMail()
{
// Send mail code goes here.
}
}
Hope this will help you to achieve your goal.