63 lines
1.5 KiB
C#
63 lines
1.5 KiB
C#
namespace NPP.SmartSchedue.Api.Contracts.Core.Configuration;
|
|
|
|
/// <summary>
|
|
/// 邮件配置
|
|
/// </summary>
|
|
public class EmailConfiguration
|
|
{
|
|
/// <summary>
|
|
/// 配置节点名称
|
|
/// </summary>
|
|
public const string SectionName = "EmailNotification";
|
|
|
|
/// <summary>
|
|
/// SMTP服务器地址
|
|
/// </summary>
|
|
public string SmtpServer { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// SMTP端口
|
|
/// </summary>
|
|
public int SmtpPort { get; set; } = 587;
|
|
|
|
/// <summary>
|
|
/// 发送者邮箱
|
|
/// </summary>
|
|
public string SenderEmail { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// 发送者密码
|
|
/// </summary>
|
|
public string SenderPassword { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// 发送者名称
|
|
/// </summary>
|
|
public string SenderName { get; set; } = "NPP智能生产调度系统";
|
|
|
|
/// <summary>
|
|
/// 是否启用SSL
|
|
/// </summary>
|
|
public bool EnableSsl { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// 超时时间(秒)
|
|
/// </summary>
|
|
public int TimeoutSeconds { get; set; } = 30;
|
|
|
|
/// <summary>
|
|
/// 是否启用邮件服务
|
|
/// </summary>
|
|
public bool Enabled { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// 验证配置是否有效
|
|
/// </summary>
|
|
public bool IsValid()
|
|
{
|
|
return !string.IsNullOrWhiteSpace(SmtpServer) &&
|
|
SmtpPort > 0 &&
|
|
!string.IsNullOrWhiteSpace(SenderEmail) &&
|
|
!string.IsNullOrWhiteSpace(SenderPassword);
|
|
}
|
|
} |