Пример #1
0
 private void OnSendEMailLogComplete(MailUserToken userToken, NotifyState notifyState)
 {
     if (userToken == null) return;
     NotifyContent ntfContext = userToken.NtfContext;
     ntfContext.NotifyState = notifyState;
     bool res = MonitorDataAccessor.Instance().InsertSendEmailOprLog(DateTime.Now.ToString("yyyy-MM-dd"),
       CommandTextParser.GetJsonSerialization<NotifyContent>(ntfContext),
       SystemHelper.GetUtcTicksByDateTime(DateTime.Now));
     //写日志
 }
 private void OnSendEMailLogComplete(MailUserToken userToken,NotifyState notifyState)
 {
     if (this.WriteSendEMailLogEvent != null)
     {
         this.WriteSendEMailLogEvent.Invoke(userToken, notifyState);
     }
 }
Пример #3
0
        public object Clone()
        {
            MailUserToken temp = new MailUserToken(this._msgID, this._logFileName, this._ntfContext);

            return(temp);
        }
        private bool SendOneNotify(NotifyContent notifyContent, string logFileName)
        {
            lock (_sendObj)
            {
                //发送邮件
                SmtpException smtpEx = new SmtpException();

                MailUserToken userToken = new MailUserToken(notifyContent.MsgID, logFileName, notifyContent);
                List<string> receiver = new List<string>();
                for (int i = 0; i < _emailConfig.ReceiveInfoList.Count; i++)
                {
                    receiver.Add(_emailConfig.ReceiveInfoList[i].EmailAddr);
                }
                if (receiver.Count <= 0)
                {
                    return false;
                }

                for (int i = 0; i < notifyContent.AttachmentFileNameList.Count; i++)
                {
                    _mailSender.Attachments(notifyContent.AttachmentFileNameList[i]);
                }
                bool isSendSucceed = true;
                if (!_mailSender.SetMailMessageContext(notifyContent.MsgContent, notifyContent.MsgTitle, false))
                {
                    isSendSucceed = false;
                }
                else
                {
                    if (!_mailSender.SendAsync(receiver, System.Net.Mail.MailPriority.Normal,
                                               ref smtpEx, userToken))
                    {
                        isSendSucceed = false;
                    }
                    else
                    {
                        _bSending = true;
                    }
                }
                if (_emailConfig.EnableJournal)
                {
                    #region 写入日志

                    #endregion
                }
                return isSendSucceed;
            }
        }
Пример #5
0
 public object Clone()
 {
     MailUserToken temp = new MailUserToken(this._msgID, this._logFileName,this._ntfContext);
     return temp;
 }