Commit 9aa4f5c4 by Carl Bergquist Committed by GitHub

Merge pull request #9341 from thz/smtp_ehlo_identity

introduce smtp config option for EHLO identity
parents 3fac31e8 af79d046
...@@ -318,6 +318,7 @@ key_file = ...@@ -318,6 +318,7 @@ key_file =
skip_verify = false skip_verify = false
from_address = admin@grafana.localhost from_address = admin@grafana.localhost
from_name = Grafana from_name = Grafana
ehlo_identity =
[emails] [emails]
welcome_email_on_sign_up = false welcome_email_on_sign_up = false
......
...@@ -295,6 +295,8 @@ ...@@ -295,6 +295,8 @@
;skip_verify = false ;skip_verify = false
;from_address = admin@grafana.localhost ;from_address = admin@grafana.localhost
;from_name = Grafana ;from_name = Grafana
# EHLO identity in SMTP dialog (defaults to instance_name)
;ehlo_identity = dashboard.example.com
[emails] [emails]
;welcome_email_on_sign_up = false ;welcome_email_on_sign_up = false
......
...@@ -161,6 +161,7 @@ Only works with Basic Authentication (username and password). See [introduction] ...@@ -161,6 +161,7 @@ Only works with Basic Authentication (username and password). See [introduction]
"enabled":"false", "enabled":"false",
"from_address":"admin@grafana.localhost", "from_address":"admin@grafana.localhost",
"from_name":"Grafana", "from_name":"Grafana",
"ehlo_identity":"dashboard.example.com",
"host":"localhost:25", "host":"localhost:25",
"key_file":"", "key_file":"",
"password":"************", "password":"************",
......
...@@ -593,6 +593,9 @@ Address used when sending out emails, defaults to `admin@grafana.localhost` ...@@ -593,6 +593,9 @@ Address used when sending out emails, defaults to `admin@grafana.localhost`
### from_name ### from_name
Name to be used when sending out emails, defaults to `Grafana` Name to be used when sending out emails, defaults to `Grafana`
### ehlo_identity
Name to be used as client identity for EHLO in SMTP dialog, defaults to instance_name.
## [log] ## [log]
### mode ### mode
......
...@@ -101,7 +101,11 @@ func createDialer() (*gomail.Dialer, error) { ...@@ -101,7 +101,11 @@ func createDialer() (*gomail.Dialer, error) {
d := gomail.NewDialer(host, iPort, setting.Smtp.User, setting.Smtp.Password) d := gomail.NewDialer(host, iPort, setting.Smtp.User, setting.Smtp.Password)
d.TLSConfig = tlsconfig d.TLSConfig = tlsconfig
d.LocalName = setting.InstanceName if setting.Smtp.EhloIdentity != "" {
d.LocalName = setting.Smtp.EhloIdentity
} else {
d.LocalName = setting.InstanceName
}
return d, nil return d, nil
} }
......
package setting package setting
type SmtpSettings struct { type SmtpSettings struct {
Enabled bool Enabled bool
Host string Host string
User string User string
Password string Password string
CertFile string CertFile string
KeyFile string KeyFile string
FromAddress string FromAddress string
FromName string FromName string
SkipVerify bool EhloIdentity string
SkipVerify bool
SendWelcomeEmailOnSignUp bool SendWelcomeEmailOnSignUp bool
TemplatesPattern string TemplatesPattern string
...@@ -25,6 +26,7 @@ func readSmtpSettings() { ...@@ -25,6 +26,7 @@ func readSmtpSettings() {
Smtp.KeyFile = sec.Key("key_file").String() Smtp.KeyFile = sec.Key("key_file").String()
Smtp.FromAddress = sec.Key("from_address").String() Smtp.FromAddress = sec.Key("from_address").String()
Smtp.FromName = sec.Key("from_name").String() Smtp.FromName = sec.Key("from_name").String()
Smtp.EhloIdentity = sec.Key("ehlo_identity").String()
Smtp.SkipVerify = sec.Key("skip_verify").MustBool(false) Smtp.SkipVerify = sec.Key("skip_verify").MustBool(false)
emails := Cfg.Section("emails") emails := Cfg.Section("emails")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment