From 07f912cd408ddffab246c95d771c115de5fd364a Mon Sep 17 00:00:00 2001 From: Jared Goodwin Date: Wed, 12 May 2021 05:03:51 -0700 Subject: [PATCH] Skip SMTP authentication if both username and password are empty. --- Server/Services/EmailSender.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Server/Services/EmailSender.cs b/Server/Services/EmailSender.cs index e92816f9b..ed55d924a 100644 --- a/Server/Services/EmailSender.cs +++ b/Server/Services/EmailSender.cs @@ -51,7 +51,11 @@ public async Task SendEmailAsync(string toEmail, string replyTo, string su await client.ConnectAsync(AppConfig.SmtpHost, AppConfig.SmtpPort); - await client.AuthenticateAsync(AppConfig.SmtpUserName, AppConfig.SmtpPassword); + if (!string.IsNullOrWhiteSpace(AppConfig.SmtpUserName) && + !string.IsNullOrWhiteSpace(AppConfig.SmtpPassword)) + { + await client.AuthenticateAsync(AppConfig.SmtpUserName, AppConfig.SmtpPassword); + } await client.SendAsync(message); await client.DisconnectAsync(true);