feat: support socks5Proxy for AWS Email provider

This commit is contained in:
hsluoyz
2025-01-20 02:36:01 +08:00
parent ea450005e0
commit ee16616df4
3 changed files with 40 additions and 14 deletions

View File

@ -16,7 +16,9 @@ package email
import (
"crypto/tls"
"strings"
"github.com/casdoor/casdoor/conf"
"github.com/casdoor/gomail/v2"
)
@ -33,6 +35,13 @@ func NewSmtpEmailProvider(userName string, password string, host string, port in
dialer.SSL = !disableSsl
if strings.HasSuffix(host, ".amazonaws.com") {
socks5Proxy := conf.GetConfigString("socks5Proxy")
if socks5Proxy != "" {
dialer.SetSocks5Proxy(socks5Proxy)
}
}
return &SmtpEmailProvider{Dialer: dialer}
}