使用Exchange服务发送邮件服务,主要是发附件,和嵌入式图片
首先NuGet .
.NetFrameWork Microsoft.Exchange.WebServices
.net Core Microsoft.Exchange.WebServices.NETStandard
新建一个消息体类
public class SendMailContent
{
/// <summary>
/// 邮件主题
/// </summary>
public string Subject { get; set; }
/// <summary>
/// 邮件主体
/// </summary>
public MessageBody Body { get; set; }
/// <summary>
/// 发送人列表
/// </summary>
public List<EmailAddress> ToList { get; set; }
/// <summary>
/// 抄送人列表
/// </summary>
public List<EmailAddress> CcList { get; set; }
/// <summary>
/// 密件抄送收件人列表
/// </summary>
public List<EmailAddress> BccList { get; set; }
/// <summary>
/// 发送后是否保存到已发送邮件