修复139邮箱发件错误

This commit is contained in:
jinnrry 2024-05-25 23:15:39 +08:00
parent f07efce6f5
commit 2a3e8f844f
3 changed files with 4 additions and 2 deletions

View File

@ -19,6 +19,7 @@ require (
golang.org/x/crypto v0.22.0
golang.org/x/text v0.14.0
modernc.org/sqlite v1.29.6
xorm.io/builder v0.3.13
xorm.io/xorm v1.3.9
)
@ -50,5 +51,4 @@ require (
modernc.org/memory v1.8.0 // indirect
modernc.org/strutil v1.2.0 // indirect
modernc.org/token v1.1.0 // indirect
xorm.io/builder v0.3.13 // indirect
)

View File

@ -174,7 +174,8 @@ func Send(ctx *context.Context, e *parsemail.Email) (error, map[string]error) {
// 使用其他方式发送
if err != nil {
if errors.Is(err, smtp.NoSupportSTARTTLSError) {
// EOF 表示未知错误此时降级为非tls连接发送目前仅139邮箱有这个问题
if errors.Is(err, smtp.NoSupportSTARTTLSError) || err.Error() == "EOF" {
err = smtp.SendMailWithTls("", domain.mxHost+":465", nil, e.From.EmailAddress, buildAddress(tos), b)
if err != nil {
log.WithContext(ctx).Warnf("Unsafe! %s Server Not Support SMTPS & STARTTLS", domain.domain)

View File

@ -34,6 +34,7 @@ import (
)
var NoSupportSTARTTLSError = errors.New("smtp: server doesn't support STARTTLS")
var EOFError = errors.New("EOF")
// A Client represents a client connection to an SMTP server.
type Client struct {