Remove need of SMTP.Host config when defining pickupdirectorylocation
This commit is contained in:
@@ -157,6 +157,11 @@ namespace Umbraco.Cms.Core.Configuration.Models
|
||||
/// </summary>
|
||||
public bool IsSmtpServerConfigured => !string.IsNullOrWhiteSpace(Smtp?.Host);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether there is a physical pickup directory configured.
|
||||
/// </summary>
|
||||
public bool IsPickupDirectoryLocationConfigured => !string.IsNullOrWhiteSpace(Smtp?.PickupDirectoryLocation);
|
||||
|
||||
/// <summary>
|
||||
/// An int value representing the time in milliseconds to lock the database for a write operation
|
||||
/// </summary>
|
||||
|
||||
@@ -75,15 +75,13 @@ namespace Umbraco.Cms.Infrastructure.Mail
|
||||
}
|
||||
}
|
||||
|
||||
var isPickupDirectoryConfigured = !string.IsNullOrWhiteSpace(_globalSettings.Smtp?.PickupDirectoryLocation);
|
||||
|
||||
if (_globalSettings.IsSmtpServerConfigured == false && !isPickupDirectoryConfigured)
|
||||
if (!_globalSettings.IsSmtpServerConfigured && !_globalSettings.IsPickupDirectoryLocationConfigured)
|
||||
{
|
||||
_logger.LogDebug("Could not send email for {Subject}. It was not handled by a notification handler and there is no SMTP configured.", message.Subject);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isPickupDirectoryConfigured && !string.IsNullOrWhiteSpace(_globalSettings.Smtp?.From))
|
||||
if (_globalSettings.IsPickupDirectoryLocationConfigured && !string.IsNullOrWhiteSpace(_globalSettings.Smtp?.From))
|
||||
{
|
||||
// The following code snippet is the recommended way to handle PickupDirectoryLocation.
|
||||
// See more https://github.com/jstedfast/MailKit/blob/master/FAQ.md#q-how-can-i-send-email-to-a-specifiedpickupdirectory
|
||||
@@ -154,7 +152,10 @@ namespace Umbraco.Cms.Infrastructure.Mail
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// We assume this is possible if either an event handler is registered or an smtp server is configured
|
||||
/// or a pickup directory location is configured
|
||||
/// </remarks>
|
||||
public bool CanSendRequiredEmail() => _globalSettings.IsSmtpServerConfigured || _notificationHandlerRegistered;
|
||||
public bool CanSendRequiredEmail() => _globalSettings.IsSmtpServerConfigured
|
||||
|| _globalSettings.IsPickupDirectoryLocationConfigured
|
||||
|| _notificationHandlerRegistered;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user