public static bool blnSendForgotEmail(string strUserName, string strSubject) { const string udcErrorMethod = "subSendForgotEmail"; const string strFromAddress = "*****@*****.**"; const string strFromName = "BookMyShow-BackOffice"; string pstrHostName = clsSettings.Get("Common", "SMTPServer", ""); string strFileName = System.AppDomain.CurrentDomain.BaseDirectory + "Common\\Templates\\ForgotPassword.tpl"; string strBody = ""; bool blnReturn = false; if (File.Exists(strFileName) == true) { StreamReader stmFile = new StreamReader(strFileName); strBody = stmFile.ReadToEnd(); stmFile.Close(); } strBody = strBody.Replace(("{%User_dtmDateTime%}"), DateTime.Now.ToString("d MMMM yyyy")); strBody = strBody.Replace(("{%User_strEmail%}"), strUserName); try { clsMail objMail = new clsMail(); objMail.blnAddTo("Admin", clsSettings.Get("BackOffice", "ForgotMailRequest", "").ToString()); //objMail.blnAddCC("Viraj", "*****@*****.**"); objMail.blnAddFrom(strFromName, strFromAddress); blnReturn = objMail.blnSendMail(strSubject, strBody); } catch (Exception ex) { clsLog.blnLogError(udcErrorSource, udcErrorMethod, "Error sending mail !!!", ex.ToString()); } return(blnReturn); }
internal static bool blnMailimintSettlementFile(string strFileName, string strFilePath, string strFileType) { const string udcErrorMethod = "blnMailimintSettlementFile"; string strEmailList = "", strEmailListCC = ""; bool blnReturn = false; try { clsMail objMail = new clsMail(); if (strFileType == "S") { strEmailList = clsSettings.Get("IMINT", "EmailList", ""); strEmailListCC = clsSettings.Get("IMINT", "EmailListCC", ""); } else if (strFileType == "R") { strEmailList = clsSettings.Get("IMINT", "RefundEmailList", ""); strEmailListCC = clsSettings.Get("IMINT", "RefundEmailListCC", ""); } foreach (string strEmailId in strEmailList.Split(new char[] { '|' })) { if (strEmailId.Length > 0) { objMail.blnAddTo("3i-infotech", strEmailId); } } foreach (string strEmailIdCC in strEmailListCC.Split(new char[] { '|' })) { if (strEmailIdCC.Length > 0) { objMail.blnAddTo("imint", strEmailIdCC); } } objMail.blnAddFrom("BookMyShow", "*****@*****.**"); objMail.MailPriority = System.Net.Mail.MailPriority.High; objMail.blnAddAttachment(strFilePath); blnReturn = objMail.blnSendMail(strFileName, strFileName); objMail = null; } catch (Exception ex) { blnReturn = false; clsLog.blnLogError(udcErrorSource, udcErrorMethod, "Error mailing imint Settlement File : " + strFileName, ex.ToString()); } return(blnReturn); }