Adding DeliveryMethod option which we make use of in EmailSender.cs

This commit is contained in:
Elitsa Marinovska
2020-05-20 00:21:45 +02:00
parent e85ccb0dab
commit ad31db9f4a
4 changed files with 15 additions and 2 deletions

View File

@@ -8,5 +8,6 @@ namespace Umbraco.Configuration
public string Host { get; set; }
public int Port { get; set; }
public string PickupDirectoryLocation { get; set; }
public string DeliveryMethod { get; set; }
}
}

View File

@@ -72,10 +72,10 @@ namespace Umbraco.Configuration.Models
_configuration.GetValue(Prefix + "NoNodesViewPath", "~/config/splashes/NoNodes.cshtml");
public bool IsSmtpServerConfigured =>
_configuration.GetSection(Constants.Configuration.ConfigPrefix + "Smtp")?.GetChildren().Any() ?? false;
_configuration.GetSection(Constants.Configuration.ConfigGlobalPrefix + "Smtp")?.GetChildren().Any() ?? false;
public ISmtpSettings SmtpSettings =>
new SmtpSettingsImpl(_configuration.GetSection(Constants.Configuration.ConfigPrefix + "Smtp"));
new SmtpSettingsImpl(_configuration.GetSection(Constants.Configuration.ConfigGlobalPrefix + "Smtp"));
private class SmtpSettingsImpl : ISmtpSettings
{
@@ -90,6 +90,7 @@ namespace Umbraco.Configuration.Models
public string Host => _configurationSection.GetValue<string>("Host");
public int Port => _configurationSection.GetValue<int>("Port");
public string PickupDirectoryLocation => _configurationSection.GetValue<string>("PickupDirectoryLocation");
public string DeliveryMethod => _configurationSection.GetValue<string>("DeliveryMethod");
}
}
}

View File

@@ -6,5 +6,6 @@ namespace Umbraco.Core.Configuration
string Host { get; }
int Port{ get; }
string PickupDirectoryLocation { get; }
string DeliveryMethod { get; }
}
}

View File

@@ -16,6 +16,7 @@ namespace Umbraco.Tests.Common.Builders
private string _host;
private int? _port;
private string _pickupDirectoryLocation;
private string _deliveryMethod;
public SmtpSettingsBuilder(TParent parentBuilder) : base(parentBuilder)
{
@@ -45,12 +46,19 @@ namespace Umbraco.Tests.Common.Builders
return this;
}
public SmtpSettingsBuilder<TParent> WithDeliveryMethod(string deliveryMethod)
{
_deliveryMethod = deliveryMethod;
return this;
}
public override ISmtpSettings Build()
{
var from = _from ?? null;
var host = _host ?? null;
var port = _port ?? 25;
var pickupDirectoryLocation = _pickupDirectoryLocation ?? null;
var deliveryMethod = _deliveryMethod ?? null;
return new TestSmtpSettings()
{
@@ -58,6 +66,7 @@ namespace Umbraco.Tests.Common.Builders
Host = host,
Port = port,
PickupDirectoryLocation = pickupDirectoryLocation,
DeliveryMethod = deliveryMethod
};
}
@@ -67,6 +76,7 @@ namespace Umbraco.Tests.Common.Builders
public string Host { get; set; }
public int Port { get; set; }
public string PickupDirectoryLocation { get; set; }
public string DeliveryMethod { get; set; }
}
}
}