//Global file events start
void Application_Start(object sender, EventArgs e)
{
System.Timers.Timer myTimer = new System.Timers.Timer();
myTimer.Interval =60000;
myTimer.AutoReset = true;
myTimer.Elapsed += new ElapsedEventHandler(myTimer_Elapsed);
myTimer.Enabled = true;
}
public void myTimer_Elapsed(object source, System.Timers.ElapsedEventArgs e)
{
ScheduleMailandSMS _ScheduleMailandSMS = new ScheduleMailandSMS();
DataTable dttemppayinslip = GetData_PayinslipSendsmmail();
foreach (DataRow dr in dttemppayinslip.Rows)
{
_ScheduleMailandSMS.SendOrderDetailsMail("", "");
}
}
public void SendOrderDetailsMail(string bodystr, string AMEmailID)
{
DataTable dtemailsetting = _objemailsetting.GetEmailSettingAll();
if (dtemailsetting.Rows.Count > 0)
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient(dtemailsetting.Rows[0]["SmtpHost"].ToString());
mail.From = new MailAddress(dtemailsetting.Rows[0]["AdminEmail_registeruser"].ToString());
mail.To.Add("pramod,joshi@abc.com");
mail.Subject = "test mail ";
mail.Body = bodystr;
SmtpServer.Port = Convert.ToInt16(dtemailsetting.Rows[0]["SMTPPort"]);
SmtpServer.Credentials = new System.Net.NetworkCredential(dtemailsetting.Rows[0]["SMTPEmail"].ToString(), dtemailsetting.Rows[0]["SMTPPassword"].ToString());
SmtpServer.EnableSsl = false;
mail.IsBodyHtml = true;
SmtpServer.Send(mail);
}
else
{
}
}
//Mail send function End