mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-02 03:00:18 +08:00
feat: support socks5Proxy for AWS Email provider
This commit is contained in:
@ -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}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user