Scheduling Newsletter on regular interval using Timer

Hi All,

In web application we need to send newsletter on regular interval then we can do it in many ways. Generally we use windows service and put it on server and schedule it but in shared host environment we can not manage it smoothly. It is difficult to manage our service on shared host environment.

So I am representing a simple way, How to manage newsletter on regular interval?

We can manage it through our web application also, no need any extra resources.

Put below code in Global.asax file.

void Application_Start(object sender, EventArgs e)
{
    System.Timers.Timer myProjectTimer = new System.Timers.Timer();
    myProjectTimer.Interval = 30000;
    myProjectTimer.AutoReset = true;
    myProjectTimer.Elapsed += new timerEventHandler(myProjectTimer_Elapsed);
    myProjectTimer.Enabled = true;
}
public void myProjectTimer_Elapsed(objectsource,System.Timers.ElapsedEventArgse)
{
    newsletterClass objnewsletterClass = new newsletterClass();
    objnewsletterClass.sendNewsletter();
}