初步完成邮件功能
This commit is contained in:
89
DMS.Infrastructure/Entities/DbEmailAccount.cs
Normal file
89
DMS.Infrastructure/Entities/DbEmailAccount.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using SqlSugar;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace DMS.Infrastructure.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 邮件账户数据库实体
|
||||
/// </summary>
|
||||
[SugarTable("email_accounts")]
|
||||
public class DbEmailAccount
|
||||
{
|
||||
/// <summary>
|
||||
/// 账户ID
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 账户名称
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 100)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 邮箱地址
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 255)]
|
||||
public string EmailAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// SMTP服务器地址
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 100)]
|
||||
public string SmtpServer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// SMTP端口号
|
||||
/// </summary>
|
||||
public int SmtpPort { get; set; } = 587;
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用SSL
|
||||
/// </summary>
|
||||
public bool EnableSsl { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 用户名
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 100)]
|
||||
public string Username { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 密码
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 100)]
|
||||
public string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// IMAP服务器地址
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 100, IsNullable = true)]
|
||||
public string? ImapServer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// IMAP端口号
|
||||
/// </summary>
|
||||
public int ImapPort { get; set; } = 993;
|
||||
|
||||
/// <summary>
|
||||
/// 是否为默认账户
|
||||
/// </summary>
|
||||
public bool IsDefault { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool IsActive { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreatedAt { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
||||
46
DMS.Infrastructure/Entities/DbEmailLog.cs
Normal file
46
DMS.Infrastructure/Entities/DbEmailLog.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using SqlSugar;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace DMS.Infrastructure.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 邮件日志数据库实体
|
||||
/// </summary>
|
||||
[SugarTable("email_logs")]
|
||||
public class DbEmailLog
|
||||
{
|
||||
/// <summary>
|
||||
/// 日志ID
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联的邮件ID
|
||||
/// </summary>
|
||||
public int EmailMessageId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 日志级别
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 20)]
|
||||
public string Level { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 日志消息
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 4000)]
|
||||
public string Message { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 异常详情
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 2000, IsNullable = true)]
|
||||
public string? Exception { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreatedAt { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
||||
86
DMS.Infrastructure/Entities/DbEmailMessage.cs
Normal file
86
DMS.Infrastructure/Entities/DbEmailMessage.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using SqlSugar;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace DMS.Infrastructure.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 邮件消息数据库实体
|
||||
/// </summary>
|
||||
[SugarTable("email_messages")]
|
||||
public class DbEmailMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// 邮件ID
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联的邮件账户ID
|
||||
/// </summary>
|
||||
public int EmailAccountId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发件人邮箱地址
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 255)]
|
||||
public string From { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 收件人邮箱地址(多个用分号分隔)
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 1000)]
|
||||
public string To { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 抄送邮箱地址(多个用分号分隔)
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 1000, IsNullable = true)]
|
||||
public string? Cc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 密送邮箱地址(多个用分号分隔)
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 1000, IsNullable = true)]
|
||||
public string? Bcc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 邮件主题
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 500)]
|
||||
public string Subject { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 邮件正文
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 4000)]
|
||||
public string Body { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否为HTML格式
|
||||
/// </summary>
|
||||
public bool IsHtml { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 邮件发送状态
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 20)]
|
||||
public string Status { get; set; } = "Pending";
|
||||
|
||||
/// <summary>
|
||||
/// 发送时间
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public DateTime? SentAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreatedAt { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
||||
62
DMS.Infrastructure/Entities/DbEmailTemplate.cs
Normal file
62
DMS.Infrastructure/Entities/DbEmailTemplate.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using SqlSugar;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace DMS.Infrastructure.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 邮件模板数据库实体
|
||||
/// </summary>
|
||||
[SugarTable("email_templates")]
|
||||
public class DbEmailTemplate
|
||||
{
|
||||
/// <summary>
|
||||
/// 模板ID
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模板名称
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 100)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模板代码(唯一标识)
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 50)]
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模板主题
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 500)]
|
||||
public string Subject { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模板内容
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 4000)]
|
||||
public string Body { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否为HTML格式
|
||||
/// </summary>
|
||||
public bool IsHtml { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool IsActive { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreatedAt { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user