Files
Umbraco-CMS/src/Umbraco.Core/Configuration/HealthChecks/NotificationEmailCheck.cs

36 lines
1.6 KiB
C#
Raw Normal View History

using System.Collections.Generic;
using Microsoft.Extensions.Logging;
using Umbraco.Core.Hosting;
using Umbraco.Core.IO;
using Umbraco.Core.Services;
namespace Umbraco.Web.HealthCheck.Checks.Config
{
[HealthCheck("3E2F7B14-4B41-452B-9A30-E67FBC8E1206", "Notification Email Settings",
Description = "If notifications are used, the 'from' email address should be specified and changed from the default value.",
Group = "Configuration")]
public class NotificationEmailCheck : AbstractConfigCheck
{
private const string DefaultFromEmail = "your@email.here";
public NotificationEmailCheck(ILocalizedTextService textService, IHostingEnvironment hostingEnvironment, ILoggerFactory loggerFactory)
: base(textService, hostingEnvironment, loggerFactory)
{ }
public override string FilePath => "~/Config/umbracoSettings.config";
public override string XPath => "/settings/content/notifications/email";
public override ValueComparisonType ValueComparisonType => ValueComparisonType.ShouldNotEqual;
public override IEnumerable<AcceptableConfiguration> Values => new List<AcceptableConfiguration>
{
new AcceptableConfiguration { IsRecommended = false, Value = DefaultFromEmail }
};
public override string CheckSuccessMessage => TextService.Localize("healthcheck/notificationEmailsCheckSuccessMessage", new [] { CurrentValue } );
public override string CheckErrorMessage => TextService.Localize("healthcheck/notificationEmailsCheckErrorMessage", new[] { DefaultFromEmail });
}
2017-07-20 11:21:28 +02:00
}