static SimpleMailConfig BuildSmptpConfig() { SimpleMailConfig resultConfig = new SimpleMailConfig(); try { string tempValue = ""; resultConfig.EmailTo = ConfigurationManager.AppSettings["EmailTo"]; resultConfig.EmailFromUsername = ConfigurationManager.AppSettings["EmailFromUsername"]; resultConfig.EmailFrom = ConfigurationManager.AppSettings["EmailFrom"]; resultConfig.EmailFromPassword = ConfigurationManager.AppSettings["EmailFromPassword"]; resultConfig.SmtpHost = ConfigurationManager.AppSettings["SmtpHost"]; tempValue = ConfigurationManager.AppSettings["SmtpPort"]; resultConfig.SmtpPort = ((!string.IsNullOrEmpty(tempValue)) && (int.TryParse(tempValue, out resultConfig.SmtpPort))) ? resultConfig.SmtpPort : 587; resultConfig.SubjectPattern = ConfigurationManager.AppSettings["SubjectPattern"]; resultConfig.BodyPattern = ConfigurationManager.AppSettings["BodyPattern"]; } catch (Exception) { var Nop = "nop"; } return resultConfig; }
internal static void SendNotification_viaEmail(string i_moduleName, string i_message, SimpleMailConfig i_mailConfig) { SimpleMail sMsg = new SimpleMail(i_mailConfig); sMsg.Subject = String.Format(i_mailConfig.SubjectPattern, i_moduleName, i_message); string body = BuildBody(i_moduleName, i_message, i_mailConfig.BodyPattern); sMsg.Body = body; sMsg.Send(); }
public SimpleMail(SimpleMailConfig i_mailConfig) { m_mailConfig = i_mailConfig; return; }