Skips auth in SMTP notifier if creds are blank

pull/156/head
Jiahao Li 2019-03-20 23:05:55 -04:00
parent 763cf981be
commit 85fa1688a7
1 changed files with 6 additions and 4 deletions

View File

@ -230,10 +230,12 @@ func (u *email) OnTest() error {
if err != nil { if err != nil {
return err return err
} }
auth := smtp.PlainAuth("", u.Username, u.Password, host) if u.Username != "" || u.Password != "" {
err = dial.Auth(auth) auth := smtp.PlainAuth("", u.Username, u.Password, host)
if err != nil { err = dial.Auth(auth)
return err if err != nil {
return err
}
} }
testService := &types.Service{ testService := &types.Service{
Id: 1, Id: 1,