完善管理员重置结果提示并缩短邮件验证等待

This commit is contained in:
xuans committed 2026-09-19 22:53:58 +08:00
1 parent 0eb9ba071c
commit aa6b45a301
10 files changed
+290 -14

No files matched your search

+2 -1
View File
@@ -70,7 +70,8 @@ func deliverMX(hosts []string, attempt func(host, port string) error) error {
func deliverMXContext(ctx stdcontext.Context, hosts []string, attempt func(host, port string) error) error {
var lastErr error
for _, host := range hosts {
for _, port := range []string{"25", "587", "465"} {
// 标准投递端口不可达时优先尝试隐式 TLS,避免先等待不提供欢迎响应的提交端口。
for _, port := range []string{"25", "465", "587"} {
if err := ctx.Err(); err != nil {
return err
}
+14
View File
@@ -93,3 +93,17 @@ func TestRetryable(t *testing.T) {
}
}
}
func TestDeliverMXUsesTLSFallbackBeforeSubmissionPort(t *testing.T) {
var calls []string
err := deliverMX([]string{"mx.example.com"}, func(host, port string) error {
calls = append(calls, port)
if port == "465" {
return nil
}
return &net.OpError{Op: "dial", Err: io.EOF}
})
if err != nil || !reflect.DeepEqual(calls, []string{"25", "465"}) {
t.Fatalf("加密路由可用时不应等待提交端口:calls=%v err=%v", calls, err)
}
}