using System.Configuration;
using System;
using System.IO;
using CK.SCP.Utils;
using System.Text;
using NPOI.HSSF.UserModel;
using System.Collections.Generic;
using MailKit.Security;
namespace CK.SCP.Common
{
public class MailManager
{
///
/// 发送邮件
///
///
///
///
public static void SendMail(string mails = "", string mailbody = "", string p_MailTitle ="" )
{
try
{
List toList = new List();
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);
}
}
}
}