From 2006b02f599145b936c6d5eeab4909b3f093a95f Mon Sep 17 00:00:00 2001 From: Mariusz Gronczewski Date: Sun, 9 Feb 2020 14:25:23 +0100 Subject: [PATCH] smtp_configure.go: disable smtp auth when unset --- api/smtp_configure.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api/smtp_configure.go b/api/smtp_configure.go index 4be4d82..1917e0e 100644 --- a/api/smtp_configure.go +++ b/api/smtp_configure.go @@ -19,10 +19,6 @@ func smtpConfigure() error { return nil } - if username == "" || password == "" { - logger.Warningf("no SMTP username/password set, Commento will assume they aren't required") - } - if os.Getenv("SMTP_FROM_ADDRESS") == "" { logger.Errorf("COMMENTO_SMTP_FROM_ADDRESS not set") smtpConfigured = false @@ -30,7 +26,11 @@ func smtpConfigure() error { } logger.Infof("configuring smtp: %s", host) - smtpAuth = smtp.PlainAuth("", username, password, host) + if username == "" || password == "" { + logger.Warningf("no SMTP username/password set, Commento will assume they aren't required") + } else { + smtpAuth = smtp.PlainAuth("", username, password, host) + } smtpConfigured = true return nil }