mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-30 03:28:28 -07:00
#1462 #865 Had to refactor how we use notificaitons. So we now have more notification fields about the request
This commit is contained in:
parent
b69b322bd5
commit
b52a57b117
21 changed files with 256 additions and 112 deletions
|
@ -6,22 +6,34 @@ namespace Ombi.Notifications.Templates
|
|||
{
|
||||
public class EmailBasicTemplate : IEmailBasicTemplate
|
||||
{
|
||||
public string TemplateLocation => Path.Combine(Directory.GetCurrentDirectory(), "Templates","BasicTemplate.html");
|
||||
public string TemplateLocation
|
||||
{
|
||||
get
|
||||
{
|
||||
#if DEBUG
|
||||
return Path.Combine(Directory.GetCurrentDirectory(), "bin","Debug", "netcoreapp1.1","Templates", "BasicTemplate.html");
|
||||
#else
|
||||
return Path.Combine(Directory.GetCurrentDirectory(), "Templates","BasicTemplate.html");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private const string SubjectKey = "{@SUBJECT}";
|
||||
private const string BodyKey = "{@BODY}";
|
||||
private const string ImgSrc = "{@IMGSRC}";
|
||||
private const string DateKey = "{@DATENOW}";
|
||||
|
||||
public string LoadTemplate(string subject, string body, string imgSrc)
|
||||
public string LoadTemplate(string subject, string body, string img)
|
||||
{
|
||||
try
|
||||
{
|
||||
var sb = new StringBuilder(File.ReadAllText(TemplateLocation));
|
||||
sb.Replace(SubjectKey, subject);
|
||||
sb.Replace(BodyKey, body);
|
||||
sb.Replace(ImgSrc, imgSrc);
|
||||
sb.Replace(DateKey, DateTime.Now.ToString("f"));
|
||||
sb.Replace(ImgSrc, img);
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue