Add support for custom SMTP HELO hostname (for FQDNS)
This commit is contained in:
parent
047de69770
commit
9a88c2ed7b
|
@ -84,6 +84,11 @@ max_idle = 10
|
|||
username = "xxxxx"
|
||||
password = ""
|
||||
|
||||
# Optional. Some SMTP servers require a FQDN in the hostname.
|
||||
# By default, HELLOs go with "localhost". Set this if a custom
|
||||
# hostname should be used.
|
||||
hello_hostname = ""
|
||||
|
||||
# Maximum time (milliseconds) to wait per e-mail push.
|
||||
send_timeout = 5000
|
||||
|
||||
|
|
2
go.mod
2
go.mod
|
@ -30,4 +30,6 @@ require (
|
|||
gopkg.in/volatiletech/null.v6 v6.0.0-20170828023728-0bef4e07ae1b
|
||||
)
|
||||
|
||||
replace github.com/jordan-wright/email => github.com/knadh/email v0.0.0-20200206100304-6d2c7064c2e8
|
||||
|
||||
go 1.13
|
||||
|
|
4
go.sum
4
go.sum
|
@ -24,6 +24,10 @@ github.com/jmoiron/sqlx v1.2.0 h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA=
|
|||
github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
|
||||
github.com/jordan-wright/email v0.0.0-20181027021455-480bedc4908b h1:veTPVnbkOijplSJVywDYKDRPoZEN39kfuMDzzRKP0FA=
|
||||
github.com/jordan-wright/email v0.0.0-20181027021455-480bedc4908b/go.mod h1:1c7szIrayyPPB/987hsnvNzLushdWf4o/79s3P08L8A=
|
||||
github.com/knadh/email v0.0.0-20181027021455-480bedc4908b h1:EJPKWXCv9G08Gs5KWjUP8PKj8trrRsLO8B90KZycApE=
|
||||
github.com/knadh/email v0.0.0-20181027021455-480bedc4908b/go.mod h1:xqJp94kA9qz2ffXuDJueBN+K6MP5BfEGmbIHR8MDJOo=
|
||||
github.com/knadh/email v0.0.0-20200206100304-6d2c7064c2e8 h1:HVq7nA5uWjpo93WsWjva1YIBuQrr8UkWQEUbzg1DX+E=
|
||||
github.com/knadh/email v0.0.0-20200206100304-6d2c7064c2e8/go.mod h1:Fy2gCFfZhay8jplf/Csj6cyH/oshQTkLQYZbKkcV+SY=
|
||||
github.com/knadh/goyesql v1.1.1 h1:iQLgsjYI/zC417DhmZYxmJgWmCHhtV4fho5QazWL/1g=
|
||||
github.com/knadh/goyesql v1.1.1/go.mod h1:W0tSzU8l7lYH1Fihj+bdQzkzOwvirrsMNHwkuY22qoY=
|
||||
github.com/knadh/goyesql v2.0.0+incompatible h1:hJFJrU8kaiLmvYt9I/1k1AB7q+qRhHs/afzTfQ3eGqk=
|
||||
|
|
|
@ -19,6 +19,7 @@ type Server struct {
|
|||
AuthProtocol string `koanf:"auth_protocol"`
|
||||
Username string `koanf:"username"`
|
||||
Password string `koanf:"password"`
|
||||
HelloHostname string `koanf:"hello_hostname"`
|
||||
SendTimeout time.Duration `koanf:"send_timeout"`
|
||||
MaxConns int `koanf:"max_conns"`
|
||||
|
||||
|
@ -52,6 +53,11 @@ func NewEmailer(srv ...Server) (Messenger, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// Optional SMTP HELLO hostname.
|
||||
if server.HelloHostname != "" {
|
||||
pool.SetHelloHostname(server.HelloHostname)
|
||||
}
|
||||
|
||||
s.mailer = pool
|
||||
e.servers[s.Name] = &s
|
||||
e.serverNames = append(e.serverNames, s.Name)
|
||||
|
|
Loading…
Reference in New Issue