统一邮件协议加密方式与端口联动
This commit is contained in:
1 parent
0975e26762
commit
b7a4614e5b
13 files changed
+369
-118
No files matched your search
@@ -149,8 +149,7 @@ func validateSMTP(smtp SMTPConfig) error {
|
||||
return ErrInvalidSMTP
|
||||
}
|
||||
}
|
||||
relayConfigured := smtp.RelayHost != "" || smtp.RelayPort != 0 || smtp.Username != "" ||
|
||||
smtp.Password.Configured() || smtp.Security != "" || smtp.From != ""
|
||||
relayConfigured := smtpRelayConfigured(smtp)
|
||||
if !relayConfigured {
|
||||
return nil
|
||||
}
|
||||
@@ -167,6 +166,12 @@ func validateSMTP(smtp SMTPConfig) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// smtpRelayConfigured 只把实际连接或发件身份字段视为启用中继。
|
||||
// 推荐端口、统一加密方式和默认发件域名单独存在时,中继仍保持可选状态。
|
||||
func smtpRelayConfigured(smtp SMTPConfig) bool {
|
||||
return smtp.RelayHost != "" || smtp.Username != "" || smtp.Password.Configured() || smtp.From != ""
|
||||
}
|
||||
|
||||
func validateSSL(ssl SSLConfig) error {
|
||||
if !isControlledRelativePath(ssl.DefaultDirectory) {
|
||||
return ErrInvalidSSL
|
||||
|
||||
Reference in new issue
Block a user