feat(email): notify_emails 空列表回退租户 brand.email(站点邮箱作默认通知收件人)
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -52,11 +52,18 @@ def resolve_email_settings(config_data: dict | None) -> dict:
|
|||||||
- smtp 给了 dict → 段内逐键回退(缺键/空串 → 平台设置快照对应键 →
|
- smtp 给了 dict → 段内逐键回退(缺键/空串 → 平台设置快照对应键 →
|
||||||
env 对应值, 租户可只改密码/只换 host);
|
env 对应值, 租户可只改密码/只换 host);
|
||||||
- sender_name 空 → 平台默认(_DEFAULT_SENDER_NAME);
|
- sender_name 空 → 平台默认(_DEFAULT_SENDER_NAME);
|
||||||
- notify_emails 空列表 → env NOTIFY_EMAIL 单元素。
|
- notify_emails 空列表 → 租户 brand.email 单元素(用户 2026-10-21 要求:
|
||||||
|
默认取每个租户配置的站点邮箱) → env NOTIFY_EMAIL 单元素。
|
||||||
"""
|
"""
|
||||||
email = ((config_data or {}).get("email")) or {}
|
email = ((config_data or {}).get("email")) or {}
|
||||||
smtp = email.get("smtp") or {}
|
smtp = email.get("smtp") or {}
|
||||||
notify = [e for e in (email.get("notify_emails") or []) if e]
|
notify = [e for e in (email.get("notify_emails") or []) if e]
|
||||||
|
if not notify:
|
||||||
|
# 回退 1:租户品牌配置里的 email(站点对外展示邮箱——客户留资通知
|
||||||
|
# 默认发到客户自己的联系邮箱,不需要每个租户显式配 notify_emails)
|
||||||
|
brand_email = ((config_data or {}).get("brand") or {}).get("email")
|
||||||
|
if brand_email:
|
||||||
|
notify = [brand_email]
|
||||||
return {
|
return {
|
||||||
"host": (smtp.get("host")
|
"host": (smtp.get("host")
|
||||||
or settings_store.get("smtp.host")
|
or settings_store.get("smtp.host")
|
||||||
|
|||||||
Reference in New Issue
Block a user