using MimeKit.Text; using System; using System.Collections.Generic; using System.Text; using Common; namespace Common.Tools.Email { /// /// 邮件内容实体 /// public class MailBodyEntity { public MailBodyEntity() { } /// /// /// /// 收件人Email /// Email主题 /// 邮件内容 默认html格式 public MailBodyEntity(List Recipients, string Subject, string Body, string SendName, string SendAccess = null) { this.Recipients =Recipients; this.Subject = Subject; this.Body = Body; this.SenderAddress = SenderAddress; this.Sender = SendName; } /// /// Email UniqueId /// public long UniqueId { get; set; } /// ///Email MessageId /// public string MessageId { get; set; } /// /// 邮件文本内容 /// public string MailTextBody { get; set; } /// /// 邮件内容类型 /// public TextFormat MailBodyType { get; set; } = TextFormat.Html; /// /// 邮件附件集合 /// public List MailFiles { get; set; } = new List(); /// /// 收件人 /// public List Recipients { get; set; } /// /// 抄送 /// public List Cc { get; set; } = new List(); /// /// 密送 /// public List Bcc { get; set; } = new List(); /// /// 发件人 如果多个,间隔 /// public string Sender { get; set; } = ""; /// /// 发送时间 Email的时间一般是世界UTC时间 /// public long SendTime { get; set; } /// /// 发件人地址 /// public string SenderAddress { get; set; } /// /// 邮件主题 /// public string Subject { get; set; } = ""; /// /// 邮件内容 /// public string Body { get; set; } } /// /// 邮件附件 /// public class MailFile { /// /// 邮件附件文件类型 例如:图片 MailFileType="image" /// public string MailFileType { get; set; } /// /// 邮件附件文件子类型 例如:图片 MailFileSubType="png" /// public string MailFileSubType { get; set; } /// /// 邮件附件文件路径 例如:图片 MailFilePath=@"C:\Files\123.png" /// public string MailFilePath { get; set; } /// /// 文件名称包含后缀名 /// public string FileName { get; set; } } /// /// 邮件服务器基础信息 /// public class MailServerInformation { /// /// SMTP服务器支持SASL机制类型 /// public bool Authentication { get; set; } /// /// SMTP服务器对消息的大小 /// public uint Size { get; set; } /// /// SMTP服务器支持传递状态通知 /// public bool Dsn { get; set; } /// /// SMTP服务器支持Content-Transfer-Encoding /// public bool EightBitMime { get; set; } /// /// SMTP服务器支持Content-Transfer-Encoding /// public bool BinaryMime { get; set; } /// /// SMTP服务器在消息头中支持UTF-8 /// public string UTF8 { get; set; } } /// /// 邮件发送结果 /// public class SendResultEntity { /// /// 结果信息 /// public string ResultInformation { get; set; } = "发送成功!"; /// /// 结果状态 /// public bool ResultStatus { get; set; } = true; } /// /// 邮件收发送服务器配置 /// public class SendServerConfigurationEntity { /// /// 邮箱SMTP服务器地址 /// public string SmtpHost { get; set; } /// /// 邮箱SMTP服务器端口 /// public int SmtpPort { get; set; } /// /// 是否启用IsSsl /// public bool IsSsl { get; set; } /// /// 邮件编码 /// public string MailEncoding { get; set; } = "utf-8"; /// /// 邮箱账号 /// public string SenderAccount { get; set; } /// /// 邮箱密码 /// public string SenderPassword { get; set; } } }