mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
Added the logo in the email notifications to use the application image #1459
This commit is contained in:
parent
3cc45b3022
commit
a77e518315
4 changed files with 25 additions and 24 deletions
|
@ -11,36 +11,29 @@ namespace Ombi.Notifications.Templates
|
|||
get
|
||||
{
|
||||
#if DEBUG
|
||||
return Path.Combine(Directory.GetCurrentDirectory(), "bin","Debug", "netcoreapp1.1","Templates", "BasicTemplate.html");
|
||||
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}";
|
||||
private const string Logo = "{@DATENOW}";
|
||||
|
||||
public string LoadTemplate(string subject, string body, string img)
|
||||
public string LoadTemplate(string subject, string body, string img, string logo)
|
||||
{
|
||||
try
|
||||
{
|
||||
var sb = new StringBuilder(File.ReadAllText(TemplateLocation));
|
||||
sb.Replace(SubjectKey, subject);
|
||||
sb.Replace(BodyKey, body);
|
||||
sb.Replace(DateKey, DateTime.Now.ToString("f"));
|
||||
sb.Replace(ImgSrc, img);
|
||||
var sb = new StringBuilder(File.ReadAllText(TemplateLocation));
|
||||
sb.Replace(SubjectKey, subject);
|
||||
sb.Replace(BodyKey, body);
|
||||
sb.Replace(DateKey, DateTime.Now.ToString("f"));
|
||||
sb.Replace(ImgSrc, img);
|
||||
sb.Replace(Logo, string.IsNullOrEmpty(logo) ? "http://i.imgur.com/qQsN78U.png" : logo);
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{
|
||||
public interface IEmailBasicTemplate
|
||||
{
|
||||
string LoadTemplate(string subject, string body, string img);
|
||||
string LoadTemplate(string subject, string body, string img, string logo);
|
||||
string TemplateLocation { get; }
|
||||
}
|
||||
}
|
|
@ -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="http://i.imgur.com/qQsN78U.png" width="400px" text-align="center" />
|
||||
<img src="{@LOGO}" width="400px" text-align="center" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue