Implement HELLO_HOSTNAME runtime configuration variable

This commit is contained in:
Ioannis Dressos 2023-10-29 16:08:48 +02:00 committed by GitHub
parent ca42b4aeab
commit 08024e2ad7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 3 deletions

View file

@ -13,6 +13,7 @@ type SmtpMail struct {
port int
username string
password string
helloHostName string
authType mail.AuthType
encryption mail.Encryption
noTLSCheck bool
@ -46,8 +47,8 @@ func encryptionType(encryptionType string) mail.Encryption {
}
}
func NewSmtpMail(hostname string, port int, username string, password string, noTLSCheck bool, auth string, fromName, from string, encryption string) *SmtpMail {
ans := SmtpMail{hostname: hostname, port: port, username: username, password: password, noTLSCheck: noTLSCheck, fromName: fromName, from: from, authType: authType(auth), encryption: encryptionType(encryption)}
func NewSmtpMail(hostname string, port int, username string, password string, helloHostName string, noTLSCheck bool, auth string, fromName, from string, encryption string) *SmtpMail {
ans := SmtpMail{hostname: hostname, port: port, username: username, password: password, helloHostName: helloHostName, noTLSCheck: noTLSCheck, fromName: fromName, from: from, authType: authType(auth), encryption: encryptionType(encryption)}
return &ans
}
@ -66,6 +67,7 @@ func (o *SmtpMail) Send(toName string, to string, subject string, content string
server.Authentication = o.authType
server.Username = o.username
server.Password = o.password
server.Helo = o.helloHostName
server.Encryption = o.encryption
server.KeepAlive = false
server.ConnectTimeout = 10 * time.Second