Added the logo in the email notifications to use the application image #1459

This commit is contained in:
Jamie.Rees 2017-08-30 12:46:19 +01:00
commit a77e518315
4 changed files with 25 additions and 24 deletions

View file

@ -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();
}
}
}

View file

@ -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; }
}
}

View file

@ -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>