Merge pull request #156 from isundaylee/authless

Skips auth in SMTP notifier if creds are blank
pull/157/head^2
Hunter Long 2019-03-25 11:20:30 -07:00 committed by GitHub
commit 88f1a51356
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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,