Merge pull request #10905 from umbraco/v9/bugfix/email-sender-ambiguous-constructor

V9/bugfix/email sender ambiguous constructor
This commit is contained in:
Paul Johnson
2021-08-19 15:07:02 +01:00
committed by GitHub
3 changed files with 10 additions and 9 deletions

View File

@@ -40,6 +40,7 @@ using Umbraco.Cms.Infrastructure.Examine;
using Umbraco.Cms.Infrastructure.HealthChecks;
using Umbraco.Cms.Infrastructure.HostedServices;
using Umbraco.Cms.Infrastructure.Install;
using Umbraco.Cms.Infrastructure.Mail;
using Umbraco.Cms.Infrastructure.Media;
using Umbraco.Cms.Infrastructure.Migrations;
using Umbraco.Cms.Infrastructure.Migrations.Install;
@@ -52,7 +53,6 @@ using Umbraco.Cms.Infrastructure.Runtime;
using Umbraco.Cms.Infrastructure.Search;
using Umbraco.Cms.Infrastructure.Serialization;
using Umbraco.Extensions;
using System;
namespace Umbraco.Cms.Infrastructure.DependencyInjection
{

View File

@@ -13,7 +13,7 @@ using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.Infrastructure.Extensions;
using SmtpClient = MailKit.Net.Smtp.SmtpClient;
namespace Umbraco.Cms.Infrastructure
namespace Umbraco.Cms.Infrastructure.Mail
{
/// <summary>
/// A utility class for sending emails
@@ -30,11 +30,15 @@ namespace Umbraco.Cms.Infrastructure
ILogger<EmailSender> logger,
IOptions<GlobalSettings> globalSettings,
IEventAggregator eventAggregator)
: this(globalSettings, eventAggregator, null)
=> _logger = logger;
: this(logger, globalSettings, eventAggregator, null) { }
public EmailSender(IOptions<GlobalSettings> globalSettings, IEventAggregator eventAggregator, INotificationHandler<SendEmailNotification> handler)
public EmailSender(
ILogger<EmailSender> logger,
IOptions<GlobalSettings> globalSettings,
IEventAggregator eventAggregator,
INotificationHandler<SendEmailNotification> handler)
{
_logger = logger;
_eventAggregator = eventAggregator;
_globalSettings = globalSettings.Value;
_notificationHandlerRegistered = handler is not null;

View File

@@ -8,10 +8,8 @@ using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Reflection;
using Castle.Core.Logging;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using Moq;
@@ -36,13 +34,12 @@ using Umbraco.Cms.Core.Routing;
using Umbraco.Cms.Core.Runtime;
using Umbraco.Cms.Core.Serialization;
using Umbraco.Cms.Core.Strings;
using Umbraco.Cms.Infrastructure;
using Umbraco.Cms.Infrastructure.Mail;
using Umbraco.Cms.Infrastructure.Persistence;
using Umbraco.Cms.Infrastructure.Persistence.Mappers;
using Umbraco.Cms.Infrastructure.Persistence.SqlSyntax;
using Umbraco.Cms.Tests.Common;
using Umbraco.Cms.Tests.Common.Testing;
using Umbraco.Cms.Web.Common.AspNetCore;
using Umbraco.Extensions;
using Constants = Umbraco.Cms.Core.Constants;
using File = System.IO.File;