Hi....
i am using a timer to invoke method and send daily mails.I kept it in Global.asax page.but its not working the timer which i had given is
myTimer.Interval = 86400000;
&
myTimer.Interval =1000*60*60*24;
i tried these two. if i kept it for 15 min it is working fine.
Thanks in advance....
Loading

Santhosh Kumar JayaramanRank #563 · 4.3K reputationPosted Aug 29, 2012, 4:21 AM EDT
Create your own class like this.
public class TimerStarter
{
private static Timer threadingTimer;
public static void StartTimer()
{
if (null == threadingTimer)
{
threadingTimer = new Timer(new TimerCallback(DoActions), HttpContext.Current, 0, 8640000);
}
}
private static void DoActions(object sender)
{
// all your mail calling methods here
}
}
Then in application_start method in global.asax file.
void Application_Start(object sender, EventArgs e)
{
TimerStarter.StartTimer();
}
Let me know if you get any prob
Sukesh MarlaRank #461 · 5.4K reputationPosted Aug 24, 2012, 3:43 AM EDT
Bindu35 reputationPosted Aug 24, 2012, 3:49 AM EDT
{
// Code that runs on application startup
System.Timers.Timer myTimer = new System.Timers.Timer();
// Set the Interval to 5 seconds (5000 milliseconds).
myTimer.Interval = 86400000;
myTimer.AutoReset = true;
myTimer.Elapsed += new ElapsedEventHandler(myTimer_Elapsed);
myTimer.Enabled = true;
}
public void myTimer_Elapsed(object source, System.Timers.ElapsedEventArgs e)
{
// use your mailer code
ScheduleMail objScheduleMail = new ScheduleMail();
objScheduleMail.SendSurveyMailDaily();
objScheduleMail.SendSurveyMailWeekly();
objScheduleMail.SendSurveyMailMonthly();
objScheduleMail.SendCampaignMailDaily();
objScheduleMail.SendCampaignMailWeekly();
objScheduleMail.SendCampaignMailMonthly();
objScheduleMail.SendTemplatMailDaily();
objScheduleMail.SendTemplateMailsMonthly();
objScheduleMail.SendTemplateMailsWeekly();
objScheduleMail.EmailRemainders();
}
this is the code i should invoke those methods
Raj Kumar4 reputationPosted Oct 9, 2013, 5:40 PM EDT
Hi Santhosh Kumar Jayaraman,
Your code is not working correctly. Mean to say doesn't give expected result. I'd set timer interval at one hour. But timer doesn't run exact at one hour. Pls help me. I am uploading the result as jpg file.
Raj Kumar4 reputationPosted Oct 9, 2013, 5:42 PM EDT