private void ServiceTimer_Tick(object sender, ElapsedEventArgs e) { string Msg = "Hi ! This is DailyMailSchedulerService mail.";//whatever msg u want to send write here. // Here you can write the ServiceLog.SendEmail("*****@*****.**", "", "", "Daily Report of DailyMailSchedulerService on " + DateTime.Now.ToString("dd-MMM-yyyy"), Msg); if (getCallType == 1) { timer1.Stop(); System.Threading.Thread.Sleep(1000000); SetTimer(); } }
protected override void OnStop() { timer1.AutoReset = false; timer1.Enabled = false; ServiceLog.WriteErrorLog("Daily Reporting service stopped"); }
protected override void OnStart(string[] args) { timer1.AutoReset = true; timer1.Enabled = true; ServiceLog.WriteErrorLog("Daily Reporting service started"); }