You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.3 KiB
43 lines
1.3 KiB
11 months ago
|
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
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 发送邮件
|
||
|
/// </summary>
|
||
|
/// <param name="mails"></param>
|
||
|
/// <param name="mailbody"></param>
|
||
|
/// <param name="p_MailTitle"></param>
|
||
|
public static void SendMail(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);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|