Skip to content

Commit 9a64df7

Browse files
authored
Merge pull request #9 from umbraco/v9/contrib
Revert accidental commit of "Remove need of SMTP.Host config when def…
2 parents cb06170 + bd63974 commit 9a64df7

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

src/Umbraco.Core/Configuration/Models/GlobalSettings.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,6 @@ public class GlobalSettings
157157
/// </summary>
158158
public bool IsSmtpServerConfigured => !string.IsNullOrWhiteSpace(Smtp?.Host);
159159

160-
/// <summary>
161-
/// Gets a value indicating whether there is a physical pickup directory configured.
162-
/// </summary>
163-
public bool IsPickupDirectoryLocationConfigured => !string.IsNullOrWhiteSpace(Smtp?.PickupDirectoryLocation);
164-
165160
/// <summary>
166161
/// An int value representing the time in milliseconds to lock the database for a write operation
167162
/// </summary>

src/Umbraco.Infrastructure/Mail/EmailSender.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,15 @@ private async Task SendAsyncInternal(EmailMessage message, string emailType, boo
7575
}
7676
}
7777

78-
if (!_globalSettings.IsSmtpServerConfigured && !_globalSettings.IsPickupDirectoryLocationConfigured)
78+
var isPickupDirectoryConfigured = !string.IsNullOrWhiteSpace(_globalSettings.Smtp?.PickupDirectoryLocation);
79+
80+
if (_globalSettings.IsSmtpServerConfigured == false && !isPickupDirectoryConfigured)
7981
{
8082
_logger.LogDebug("Could not send email for {Subject}. It was not handled by a notification handler and there is no SMTP configured.", message.Subject);
8183
return;
8284
}
8385

84-
if (_globalSettings.IsPickupDirectoryLocationConfigured && !string.IsNullOrWhiteSpace(_globalSettings.Smtp?.From))
86+
if (isPickupDirectoryConfigured && !string.IsNullOrWhiteSpace(_globalSettings.Smtp?.From))
8587
{
8688
// The following code snippet is the recommended way to handle PickupDirectoryLocation.
8789
// See more https://github.com/jstedfast/MailKit/blob/master/FAQ.md#q-how-can-i-send-email-to-a-specifiedpickupdirectory
@@ -152,10 +154,7 @@ await client.ConnectAsync(_globalSettings.Smtp.Host,
152154
/// </summary>
153155
/// <remarks>
154156
/// We assume this is possible if either an event handler is registered or an smtp server is configured
155-
/// or a pickup directory location is configured
156157
/// </remarks>
157-
public bool CanSendRequiredEmail() => _globalSettings.IsSmtpServerConfigured
158-
|| _globalSettings.IsPickupDirectoryLocationConfigured
159-
|| _notificationHandlerRegistered;
158+
public bool CanSendRequiredEmail() => _globalSettings.IsSmtpServerConfigured || _notificationHandlerRegistered;
160159
}
161160
}

0 commit comments

Comments
 (0)