mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-13 08:42:57 -07:00
Enable Multi MIME and add alt tags to images (#1838)
* Add alt to mail images * Use Mulipart MIME in emails * Requested PR changes
This commit is contained in:
parent
e1237bba7a
commit
b5bc328986
3 changed files with 35 additions and 7 deletions
|
@ -144,7 +144,7 @@
|
|||
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;" width="100%">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img src="{@LOGO}" width="400px" text-align="center" />
|
||||
<img src="{@LOGO}" alt="Ombi logo" width="400px" text-align="center" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -155,7 +155,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img src="{@IMGSRC}" width="400px" text-align="center" />
|
||||
<img src="{@IMGSRC}" alt="Poster" width="400px" text-align="center" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
@ -71,6 +71,13 @@ namespace Ombi.Notifications.Agents
|
|||
return message;
|
||||
}
|
||||
|
||||
private async Task<string> 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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue