diff --git a/MediaBrowser.Plugins.SmtpNotifications.dll b/MediaBrowser.Plugins.SmtpNotifications.dll new file mode 100644 index 0000000..569918f Binary files /dev/null and b/MediaBrowser.Plugins.SmtpNotifications.dll differ diff --git a/MediaBrowser.Plugins.SmtpNotifications/Api/ServerApiEntryPoints.cs b/MediaBrowser.Plugins.SmtpNotifications/Api/ServerApiEntryPoints.cs index 122a717..7792606 100644 --- a/MediaBrowser.Plugins.SmtpNotifications/Api/ServerApiEntryPoints.cs +++ b/MediaBrowser.Plugins.SmtpNotifications/Api/ServerApiEntryPoints.cs @@ -6,11 +6,14 @@ using MediaBrowser.Controller.Notifications; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Services; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Tasks; namespace MediaBrowser.Plugins.SmtpNotifications.Api { + [Route("/Notification/SMTP/Test/{UserID}", "POST", Summary = "Tests SMTP")] - public class TestNotification : IReturnVoid + public class TestNotification : IReturn { [ApiMember(Name = "UserID", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] public string UserID { get; set; } @@ -29,19 +32,21 @@ public ServerApiEndpoints(IUserManager userManager, ILogger logger, IEncryptionM _encryption = encryption; } - public void Post(TestNotification request) + public string Post(TestNotification request) { + var task = new Notifier(_logger, _encryption).SendNotification(new UserNotification { Date = DateTime.UtcNow, Description = "This is a test notification from Emby Server", Level = Model.Notifications.NotificationLevel.Normal, - Name = "Emby: Test Notification", + Name = "Test Notification", User = _userManager.GetUserById(request.UserID) - }, CancellationToken.None); Task.WaitAll(task); + + return ("{\"status\": \"success\"}"); } } } diff --git a/MediaBrowser.Plugins.SmtpNotifications/Configuration/PluginConfiguration.cs b/MediaBrowser.Plugins.SmtpNotifications/Configuration/PluginConfiguration.cs index f5eab58..a932fb8 100644 --- a/MediaBrowser.Plugins.SmtpNotifications/Configuration/PluginConfiguration.cs +++ b/MediaBrowser.Plugins.SmtpNotifications/Configuration/PluginConfiguration.cs @@ -18,6 +18,7 @@ public PluginConfiguration() public class SMTPOptions { public bool Enabled { get; set; } + public string EmailFromName { get; set; } public string EmailFrom { get; set; } public string EmailTo { get; set; } public string Server { get; set; } @@ -28,7 +29,7 @@ public class SMTPOptions public string PwData { get; set; } public string MediaBrowserUserId { get; set; } public bool SSL { get; set; } - + public bool ?IgnoreCertificateErrors { get; set; } public SMTPOptions() { Port = 25; diff --git a/MediaBrowser.Plugins.SmtpNotifications/Configuration/config.html b/MediaBrowser.Plugins.SmtpNotifications/Configuration/config.html index 9fa524f..1ed04ac 100644 --- a/MediaBrowser.Plugins.SmtpNotifications/Configuration/config.html +++ b/MediaBrowser.Plugins.SmtpNotifications/Configuration/config.html @@ -20,16 +20,23 @@ Enable notifications for this user +
+ +
+ The name component of the sender information for your notification emails. +
+
+
- Email Address that messages will be sent from. Sending from a free email service such as gmail, hotmail, or yahoo is not recommended. The providers may block repeated outgoing, automated email. + Email Address that messages will be sent from (format email@address.here). Sending from a free email service such as gmail, hotmail, or yahoo is not recommended. The providers may block repeated outgoing, automated email.
- Email Address that messaged will be sent to. + Email Address that the message will be sent to.
@@ -64,6 +71,12 @@ Password for your SMTP Server.
+ + +