From 570841b958b8dd3f7009a4197b2d645a733a13d4 Mon Sep 17 00:00:00 2001 From: Lennard Fonteijn Date: Mon, 8 Nov 2021 09:22:01 +0100 Subject: [PATCH] Allow appsettings.json to set SMTP authentication to string.Empty --- src/Umbraco.Infrastructure/Mail/EmailSender.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Infrastructure/Mail/EmailSender.cs b/src/Umbraco.Infrastructure/Mail/EmailSender.cs index 4ca3506fa97c..854c2fb51eb3 100644 --- a/src/Umbraco.Infrastructure/Mail/EmailSender.cs +++ b/src/Umbraco.Infrastructure/Mail/EmailSender.cs @@ -131,7 +131,7 @@ await client.ConnectAsync(_globalSettings.Smtp.Host, _globalSettings.Smtp.Port, (MailKit.Security.SecureSocketOptions)(int)_globalSettings.Smtp.SecureSocketOptions); - if (!(_globalSettings.Smtp.Username is null && _globalSettings.Smtp.Password is null)) + if (!string.IsNullOrWhiteSpace(_globalSettings.Smtp.Username) && !string.IsNullOrWhiteSpace(_globalSettings.Smtp.Password)) { await client.AuthenticateAsync(_globalSettings.Smtp.Username, _globalSettings.Smtp.Password); }