From 03add0ffc876f5b7d1d94e6e5c6a5f07b84829e4 Mon Sep 17 00:00:00 2001 From: "Jamie.Rees" Date: Tue, 8 Aug 2017 12:50:05 +0100 Subject: [PATCH] #865 #1459 Added the Sender From field for email notifcations. We can now have "Friendly Names" for email notifications. Also fixed the copy and paste error with the Settings dropdowns. Slack menu item is now labelled Slack instead of Discord --- src/Ombi.Notifications/GenericEmailProvider.cs | 5 +++-- .../Notifications/EmailNotificationSettings.cs | 3 ++- .../app/interfaces/INotifcationSettings.ts | 3 ++- .../emailnotification.component.html | 16 +++++++++++----- .../notifications/emailnotification.component.ts | 3 ++- .../notificationtemplate.component.html | 2 +- .../app/settings/settingsmenu.component.html | 2 +- 7 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/Ombi.Notifications/GenericEmailProvider.cs b/src/Ombi.Notifications/GenericEmailProvider.cs index c95fd9f23..f32b7941b 100644 --- a/src/Ombi.Notifications/GenericEmailProvider.cs +++ b/src/Ombi.Notifications/GenericEmailProvider.cs @@ -29,7 +29,7 @@ namespace Ombi.Notifications Body = body.ToMessageBody(), Subject = model.Subject }; - message.From.Add(new MailboxAddress(settings.Sender, settings.Sender)); + message.From.Add(new MailboxAddress(settings.SenderAddress, settings.SenderAddress)); message.To.Add(new MailboxAddress(model.To, model.To)); using (var client = new SmtpClient()) @@ -71,7 +71,8 @@ namespace Ombi.Notifications Body = body.ToMessageBody(), Subject = model.Subject }; - message.From.Add(new MailboxAddress(settings.Sender, settings.Sender)); + + message.From.Add(new MailboxAddress(string.IsNullOrEmpty(settings.SenderName) ? settings.SenderAddress : settings.SenderName, settings.SenderAddress)); message.To.Add(new MailboxAddress(model.To, model.To)); using (var client = new SmtpClient()) diff --git a/src/Ombi.Settings/Settings/Models/Notifications/EmailNotificationSettings.cs b/src/Ombi.Settings/Settings/Models/Notifications/EmailNotificationSettings.cs index 581062662..2e222de29 100644 --- a/src/Ombi.Settings/Settings/Models/Notifications/EmailNotificationSettings.cs +++ b/src/Ombi.Settings/Settings/Models/Notifications/EmailNotificationSettings.cs @@ -6,7 +6,8 @@ public string Host { get; set; } public string Password { get; set; } public int Port { get; set; } - public string Sender { get; set; } + public string SenderName { get; set; } + public string SenderAddress { get; set; } public string Username { get; set; } public bool Authentication { get; set; } public string AdminEmail { get; set; } diff --git a/src/Ombi/ClientApp/app/interfaces/INotifcationSettings.ts b/src/Ombi/ClientApp/app/interfaces/INotifcationSettings.ts index 18a4aa9ac..a7e53c53a 100644 --- a/src/Ombi/ClientApp/app/interfaces/INotifcationSettings.ts +++ b/src/Ombi/ClientApp/app/interfaces/INotifcationSettings.ts @@ -10,7 +10,8 @@ export interface IEmailNotificationSettings extends INotificationSettings { host: string, password: string, port: number, - sender: string, + senderAddress: string, + senderName:string, username: string, authentication: boolean, adminEmail: string, diff --git a/src/Ombi/ClientApp/app/settings/notifications/emailnotification.component.html b/src/Ombi/ClientApp/app/settings/notifications/emailnotification.component.html index ab99f01a4..6c7a1259a 100644 --- a/src/Ombi/ClientApp/app/settings/notifications/emailnotification.component.html +++ b/src/Ombi/ClientApp/app/settings/notifications/emailnotification.component.html @@ -21,8 +21,8 @@
Host is required
The Port is required
-
The Email Sender is required
-
The Email Sender needs to be a valid email address
+
The Email Sender Address is required
+
The Email Sender Address needs to be a valid email address
The Email Sender is required
The Admin Email needs to be a valid email address
The Username is required
@@ -44,10 +44,16 @@
- -
- + +
+
+
+ +
+
+
+
diff --git a/src/Ombi/ClientApp/app/settings/notifications/emailnotification.component.ts b/src/Ombi/ClientApp/app/settings/notifications/emailnotification.component.ts index ac292da05..b94a3b028 100644 --- a/src/Ombi/ClientApp/app/settings/notifications/emailnotification.component.ts +++ b/src/Ombi/ClientApp/app/settings/notifications/emailnotification.component.ts @@ -32,7 +32,8 @@ export class EmailNotificationComponent implements OnInit { host: [x.host, [Validators.required]], password: [x.password], port: [x.port, [Validators.required]], - sender: [x.sender, [Validators.required, Validators.email]], + senderAddress: [x.senderAddress, [Validators.required, Validators.email]], + senderName: [x.senderName], username: [x.username], adminEmail: [x.adminEmail, [Validators.required, Validators.email]], }); diff --git a/src/Ombi/ClientApp/app/settings/notifications/notificationtemplate.component.html b/src/Ombi/ClientApp/app/settings/notifications/notificationtemplate.component.html index 72b13063b..643a0471f 100644 --- a/src/Ombi/ClientApp/app/settings/notifications/notificationtemplate.component.html +++ b/src/Ombi/ClientApp/app/settings/notifications/notificationtemplate.component.html @@ -1,4 +1,4 @@ - + diff --git a/src/Ombi/ClientApp/app/settings/settingsmenu.component.html b/src/Ombi/ClientApp/app/settings/settingsmenu.component.html index 3982acc54..de9a5c16f 100644 --- a/src/Ombi/ClientApp/app/settings/settingsmenu.component.html +++ b/src/Ombi/ClientApp/app/settings/settingsmenu.component.html @@ -45,7 +45,7 @@
  • Email
  • Discord
  • -
  • Discord
  • +
  • Slack
  • Pushbullet
  • Pushover