Skip to content

Commit

Permalink
mail: only authenticate if user has been set.
Browse files Browse the repository at this point in the history
  • Loading branch information
stffabi committed Feb 27, 2018
1 parent 5463256 commit 28dff65
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion notifications/email.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ func (e *emailTypeNotifier) sendEntries(entries []*log.Entry) {
// Do the sending in a separate goroutine so we don't block the main process.
msg := e.buildMessage(entries)
go func() {
auth := smtp.PlainAuth("", e.User, e.Password, e.Server)
var auth smtp.Auth
if e.User != "" {
auth = smtp.PlainAuth("", e.User, e.Password, e.Server)
}
err := SendMail(e.Server+":"+strconv.Itoa(e.Port), e.tlsSkipVerify, auth, e.From, []string{e.To}, msg)
if err != nil {
// Use fmt so it doesn't trigger another email.
Expand Down

0 comments on commit 28dff65

Please sign in to comment.