收敛Smail系统通知SMTP通道并更新验收清单
完成Smail系统通知SMTP路由、验证码发送约束和相关回归测试,更新Linux生产测试记录、整改主清单及任务执行清单。
This commit is contained in:
1 parent
37b2ae016b
commit
07229adadc
9 files changed
+110
-1
No files matched your search
@@ -6,6 +6,11 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// UsesSmailSystemAccount 判断通知账号是否为 Smail 系统通知账号。
|
||||
func (c NotificationConfig) UsesSmailSystemAccount() bool {
|
||||
return strings.HasPrefix(strings.ToLower(strings.TrimSpace(c.SMTPUsername)), "notify:")
|
||||
}
|
||||
|
||||
// SenderIdentity 根据系统通知账号确定发件人,不能将管理员邮箱当作 SMTP 发件人。
|
||||
func (c NotificationConfig) SenderIdentity() (string, string, error) {
|
||||
name := strings.TrimSpace(c.SenderName)
|
||||
@@ -14,7 +19,7 @@ func (c NotificationConfig) SenderIdentity() (string, string, error) {
|
||||
return name, email, nil
|
||||
}
|
||||
username := strings.ToLower(strings.TrimSpace(c.SMTPUsername))
|
||||
if strings.HasPrefix(username, "notify:") {
|
||||
if c.UsesSmailSystemAccount() {
|
||||
account := strings.TrimPrefix(username, "notify:")
|
||||
parsed, err := mail.ParseAddress(account)
|
||||
parts := strings.Split(account, "@")
|
||||
|
||||
Reference in new issue
Block a user