using System.Threading.Tasks;
using System.Collections.Generic;
using NPP.SmartSchedue.Api.Contracts.Core.Enums;
namespace NPP.SmartSchedue.Api.Contracts.Services.Notification;
///
/// 邮件通知服务接口
/// 决策点1:基础通知方式 - 邮件通知
///
public interface IEmailNotificationService
{
#region 单个邮件发送
///
/// 发送邮件通知
///
/// 接收人邮箱
/// 邮件主题
/// 邮件内容
/// 是否HTML格式
///
Task SendEmailAsync(string recipientEmail, string subject, string content, bool isHtml = true);
///
/// 发送邮件通知(带附件)
///
/// 接收人邮箱
/// 邮件主题
/// 邮件内容
/// 附件文件路径列表
/// 是否HTML格式
///
Task SendEmailWithAttachmentsAsync(
string recipientEmail,
string subject,
string content,
List attachments,
bool isHtml = true);
#endregion
#region 批量邮件发送
///
/// 批量发送邮件通知
///
/// 接收人邮箱列表
/// 邮件主题
/// 邮件内容
/// 是否HTML格式
/// 发送结果,Key为邮箱地址,Value为是否发送成功
Task> BatchSendEmailAsync(
List recipients,
string subject,
string content,
bool isHtml = true);
///
/// 个性化批量发送邮件通知
/// 每个收件人可以有不同的邮件内容
///
/// 邮件项列表
/// 发送结果,Key为邮箱地址,Value为是否发送成功
Task> BatchSendPersonalizedEmailAsync(List emailItems);
#endregion
#region 邮件模板
///
/// 使用模板发送邮件
///
/// 接收人邮箱
/// 邮件主题模板
/// 邮件内容模板
/// 模板变量
/// 是否HTML格式
///
Task SendEmailByTemplateAsync(
string recipientEmail,
string subjectTemplate,
string contentTemplate,
Dictionary variables,
bool isHtml = true);
#endregion
#region 邮件发送状态检查
///
/// 验证邮箱地址格式
///
/// 邮箱地址
///
bool IsValidEmail(string email);
///
/// 检查邮件服务器连接状态
///
///
Task CheckEmailServerConnectionAsync();
#endregion
}
///
/// 邮件项
///
public class EmailItem
{
///
/// 接收人邮箱
///
public string RecipientEmail { get; set; } = "";
///
/// 邮件主题
///
public string Subject { get; set; } = "";
///
/// 邮件内容
///
public string Content { get; set; } = "";
///
/// 是否HTML格式
///
public bool IsHtml { get; set; } = true;
///
/// 附件文件路径列表
///
public List Attachments { get; set; } = new List();
///
/// 个性化变量
///
public Dictionary Variables { get; set; } = new Dictionary();
}