Allow appsettings.json to set SMTP authentication to string.Empty

This commit is contained in:
Lennard Fonteijn
2021-11-08 09:22:01 +01:00
committed by Michael Latouche
parent ba7db3b842
commit 570841b958

View File

@@ -131,7 +131,7 @@ namespace Umbraco.Cms.Infrastructure.Mail
_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);
}