Skip to content
bitzorcas
EN

Reference

邮件构建块

计划中的邮件/通知投递基础设施 — 当前通过 INotificationDeliveryAdapter 端口处理,默认为 Null 实现。

Last updated

BitzOrcas 尚未包含专用的邮件基础设施。通知投递通过 Notifications 平台模块中的 INotificationDeliveryAdapter 抽象处理,默认使用 NullNotificationDeliveryAdapter(空操作)。

当前通知架构

Notifications 模块提供多通道通知框架:

NotificationService
INotificationPreferenceStore ←── 通道偏好(邮件、应用内等)
INotificationDeliveryAdapter ←── 当前为 Null,未来:SMTP/SendGrid
INotificationRepository ←── 收件箱持久化 (SqlSugar)

通知类型

通道状态描述
应用内收件箱✅ 已实现NotificationEntity 持久化到数据库
邮件📋 计划中SMTP 或云邮件提供商适配器
短信📋 计划中未来扩展
推送📋 计划中未来扩展

INotificationDeliveryAdapter 端口

public interface INotificationDeliveryAdapter
{
Task DeliverAsync(NotificationTemplate template,
NotificationPreference preference,
CancellationToken ct = default);
}
  • 默认NullNotificationDeliveryAdapter — 空操作
  • 计划:SMTP 适配器、SendGrid 适配器、AWS SES 适配器

添加邮件投递

要添加邮件支持,实现 INotificationDeliveryAdapter

  1. 为你的邮件提供商创建包引用(例如 MailKit
  2. 使用 SMTP 配置实现接口
  3. 在 DI 中注册以替换 Null 默认值
  4. 配置 SMTP 设置

计划配置

{
"Mail": {
"Provider": "Smtp", // 或 "SendGrid"、"SES"
"Smtp": {
"Host": "smtp.example.com",
"Port": 587,
"Username": "noreply@example.com",
"Password": "..."
},
"FromAddress": "noreply@bitzorcas.com",
"FromName": "BitzOrcas Platform"
}
}

另见