Exemple #1
0
        private static void OnReportSendComplete(MailClass.MailInfo info)
        {
            try
            {
                //close the stream
                if (info.attachs != null && info.attachs.Count > 0)
                {
                    foreach (System.Net.Mail.Attachment att in info.attachs)
                    {
                        if (att.ContentStream != null)
                        {
                            att.ContentStream.Dispose();
                        }
                    }
                }

                string error = string.IsNullOrEmpty(info.error) ? string.Empty : info.error;
                //记录邮箱日志
                var maillog = new Users_MailLogInfo()
                {
                    ml_uid          = Guid.NewGuid().ToString().Replace("-", "").Trim().Substring(0, 16),
                    ml_type         = info.ml_type,
                    ml_to           = info.to,
                    ml_toName       = info.toName,
                    ml_cc           = string.Empty,
                    ml_title        = info.title,
                    ml_content      = info.body,
                    ml_resend       = 0,
                    ml_createTime   = DateTime.Now,
                    ml_createUser   = info.userId,
                    ml_from         = info.from,
                    ml_fromName     = info.fromName,
                    ml_resendRemark = error,
                    ml_state        = error.Length > 0 ? 0 : 1
                };


                DataAccess.Users_MailLogs_Insert(maillog);
            }
            catch { }
        }
Exemple #2
0
        private static void OnSendComplete(MailClass.MailInfo mailInfo)
        {
            var maillog = new Users_MailLogInfo()
            {
                ml_uid          = Guid.NewGuid().ToString().Replace("-", "").Trim().Substring(0, 16),
                ml_type         = mailInfo.ml_type,
                ml_to           = mailInfo.to,
                ml_toName       = mailInfo.toName,
                ml_cc           = string.Empty,
                ml_title        = mailInfo.title,
                ml_content      = mailInfo.body,
                ml_resend       = 0,
                ml_createTime   = DateTime.Now,
                ml_createUser   = mailInfo.userId,
                ml_from         = mailInfo.from,
                ml_fromName     = mailInfo.fromName,
                ml_state        = string.IsNullOrEmpty(mailInfo.error) ? 1 : 0,
                ml_resendRemark = mailInfo.error
            };

            DataAccess.Users_MailLogs_Insert(maillog);
        }