diff --git a/src/Ombi.Notifications.Templates/Templates/BasicTemplate.html b/src/Ombi.Notifications.Templates/Templates/BasicTemplate.html index 63b86e125..8482b6b40 100644 --- a/src/Ombi.Notifications.Templates/Templates/BasicTemplate.html +++ b/src/Ombi.Notifications.Templates/Templates/BasicTemplate.html @@ -144,7 +144,7 @@ @@ -155,7 +155,7 @@
- + Ombi logo
- + Poster
diff --git a/src/Ombi.Notifications/Agents/EmailNotification.cs b/src/Ombi.Notifications/Agents/EmailNotification.cs index 45be62311..123aa1e99 100644 --- a/src/Ombi.Notifications/Agents/EmailNotification.cs +++ b/src/Ombi.Notifications/Agents/EmailNotification.cs @@ -71,6 +71,13 @@ namespace Ombi.Notifications.Agents return message; } + private async Task LoadPlainTextMessage(NotificationType type, NotificationOptions model, EmailNotificationSettings settings) + { + var parsed = await LoadTemplate(NotificationAgent.Email, type, model); + + return parsed.Message; + } + protected override async Task NewRequest(NotificationOptions model, EmailNotificationSettings settings) { var message = await LoadTemplate(NotificationType.NewRequest, model, settings); @@ -78,7 +85,10 @@ namespace Ombi.Notifications.Agents { return; } - + + var plaintext = await LoadPlainTextMessage(NotificationType.NewRequest, model, settings); + message.Other.Add("PlainTextBody", plaintext); + await Send(message, settings); } @@ -89,7 +99,10 @@ namespace Ombi.Notifications.Agents { return; } - + + var plaintext = await LoadPlainTextMessage(NotificationType.Issue, model, settings); + message.Other.Add("PlainTextBody", plaintext); + // Issues should be sent to admin message.To = settings.AdminEmail; @@ -125,7 +138,10 @@ namespace Ombi.Notifications.Agents Subject = $"{Customization.ApplicationName}: A request could not be added", To = settings.AdminEmail, }; - + + var plaintext = $"Hello! The user '{user}' has requested {title} but it could not be added. This has been added into the requests queue and will keep retrying"; + message.Other.Add("PlainTextBody", plaintext); + await Send(message, settings); } @@ -136,6 +152,10 @@ namespace Ombi.Notifications.Agents { return; } + + var plaintext = await LoadPlainTextMessage(NotificationType.RequestDeclined, model, settings); + message.Other.Add("PlainTextBody", plaintext); + message.To = model.RequestType == RequestType.Movie ? MovieRequest.RequestedUser.Email : TvRequest.RequestedUser.Email; @@ -149,6 +169,10 @@ namespace Ombi.Notifications.Agents { return; } + + var plaintext = await LoadPlainTextMessage(NotificationType.RequestApproved, model, settings); + message.Other.Add("PlainTextBody", plaintext); + message.To = model.RequestType == RequestType.Movie ? MovieRequest.RequestedUser.Email : TvRequest.RequestedUser.Email; @@ -162,6 +186,10 @@ namespace Ombi.Notifications.Agents { return; } + + var plaintext = await LoadPlainTextMessage(NotificationType.RequestAvailable, model, settings); + message.Other.Add("PlainTextBody", plaintext); + message.To = model.RequestType == RequestType.Movie ? MovieRequest.RequestedUser.Email : TvRequest.RequestedUser.Email; diff --git a/src/Ombi.Notifications/GenericEmailProvider.cs b/src/Ombi.Notifications/GenericEmailProvider.cs index b5979d9aa..4a425c4af 100644 --- a/src/Ombi.Notifications/GenericEmailProvider.cs +++ b/src/Ombi.Notifications/GenericEmailProvider.cs @@ -40,7 +40,7 @@ namespace Ombi.Notifications var body = new BodyBuilder { HtmlBody = html, - //TextBody = model.Other["PlainTextBody"] + TextBody = model.Other["PlainTextBody"] }; var message = new MimeMessage @@ -104,7 +104,7 @@ namespace Ombi.Notifications var body = new BodyBuilder { HtmlBody = model.Message, - //TextBody = model.Other["PlainTextBody"] + TextBody = model.Other["PlainTextBody"] }; var message = new MimeMessage