|
|
@ -9,6 +9,7 @@ using CK.SCP.Models.AppBoxEntity; |
|
|
|
using System.Text; |
|
|
|
using CK.SCP.Utils; |
|
|
|
using System.Configuration; |
|
|
|
using MailKit.Security; |
|
|
|
|
|
|
|
namespace SCP.Common |
|
|
|
{ |
|
|
@ -46,8 +47,9 @@ namespace SCP.Common |
|
|
|
mailbody += "你好!<br><br>"; |
|
|
|
mailbody += "<b>" + p_Content + "</b> ,请到供应商协同网站" + ConfigurationManager.AppSettings["ResetPassWord"] + "打开查看!<br>"; |
|
|
|
mailbody += "<br><br><br><br>日期:" + DateTime.Now; |
|
|
|
MyWebSmtpMail webmail = new MyWebSmtpMail(); |
|
|
|
webmail.Send(mails, mailbody, p_title); |
|
|
|
//MyWebSmtpMail webmail = new MyWebSmtpMail();
|
|
|
|
SendMailOptimization(mails, mailbody, p_title); |
|
|
|
//webmail.Send(mails, mailbody, p_title);
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -146,5 +148,33 @@ namespace SCP.Common |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 优化发邮件
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="mails"></param>
|
|
|
|
/// <param name="mailbody"></param>
|
|
|
|
/// <param name="p_MailTitle"></param>
|
|
|
|
public static void SendMailOptimization(string mails = "", string mailbody = "", string p_MailTitle = "") |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
List<EmailAddress> toList = new List<EmailAddress>(); |
|
|
|
EmailAddress add = new EmailAddress(mails, mails); |
|
|
|
toList.Add(add); |
|
|
|
var smtpMailSender = new MailKitMailSender(SecureSocketOptions.StartTls); |
|
|
|
smtpMailSender.BuildMessage( |
|
|
|
toList, |
|
|
|
p_MailTitle, |
|
|
|
mailbody, |
|
|
|
"BBC" |
|
|
|
); |
|
|
|
smtpMailSender.Send(); |
|
|
|
} |
|
|
|
catch (Exception e) |
|
|
|
{ |
|
|
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(MailManager), "MailManager", e.Message + e.InnerException?.Message); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |