using System.Security.Cryptography;
namespace Entity;
///
/// 邮件消息实体
///
public class EmailMessage : BaseEntity
{
///
/// 邮件主题
///
public string Subject { get; set; } = string.Empty;
///
/// 邮件发送者
///
public string From { get; set; } = string.Empty;
///
/// 邮件正文
///
public string Body { get; set; } = string.Empty;
///
/// 邮件HTML内容
///
public string HtmlBody { get; set; } = string.Empty;
///
/// 邮件接收时间
///
public DateTime ReceivedDate { get; set; }
public string Md5 { get; set; } = string.Empty;
public string ComputeBodyHash()
{
using var md5 = MD5.Create();
var inputBytes = System.Text.Encoding.UTF8.GetBytes(Body + HtmlBody);
var hashBytes = md5.ComputeHash(inputBytes);
return Convert.ToHexString(hashBytes);
}
}