From 28dff65282404dd224b94e592da2f49788784d22 Mon Sep 17 00:00:00 2001 From: Fabrizio Steiner Date: Mon, 22 Jan 2018 20:56:18 +0100 Subject: [PATCH] mail: only authenticate if user has been set. --- notifications/email.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/notifications/email.go b/notifications/email.go index bb63329..6850ca9 100644 --- a/notifications/email.go +++ b/notifications/email.go @@ -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.