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 {
return err
}
auth := smtp.PlainAuth("", u.Username, u.Password, host)
err = dial.Auth(auth)
if err != nil {
return err
if u.Username != "" || u.Password != "" {
auth := smtp.PlainAuth("", u.Username, u.Password, host)
err = dial.Auth(auth)
if err != nil {
return err
}
}
testService := &types.Service{
Id: 1,