public void MailSending(string MailSubject, string Describe, string File_Path) { #region 数据获取 try { _recipientsAddressRange = MailRuleBLL.GetInstance().GetMailPersonListRetStr(_categoryId); List <MailBaseData> mailBaseDataList = WIPDataAccess.CreateDAL <ICommonDAL>("CommonDAL").GetMailBaseData(); if (mailBaseDataList == null || mailBaseDataList.Count == 0) { throw new Exception("没有找到邮箱基础数据"); } if (mailBaseDataList.Count > 1) { throw new Exception(string.Format("配置的邮箱基础数据大于1条,请检查数据!查到的条数是{0}条", mailBaseDataList.Count.ToString())); } _MailBaseData = mailBaseDataList[0]; } catch (Exception ex) { IDictionary <string, object> logDict = new Dictionary <string, object>(); logDict.Add("MailSubject", MailSubject); logDict.Add("Describe", Describe); ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <IDictionary <string, object> >(namespaceName, "MailSending", logDict, "", ""); WipLogHelper.GetExceptionInfoForError(ex, ref exception); WipLogHelper.WriteExceptionInfo(exception); } #endregion if (string.IsNullOrEmpty(_recipientsAddressRange) || _MailBaseData == null) // 如果基础数据没有获取到,就不发邮件 { return; } this.PostMail(_MailBaseData, _recipientsAddressRange, MailSubject, Describe.ToString(), ""); }
static MailRuleBLL() { _instance = new MailRuleBLL(); }