|
|
@ -23,8 +23,7 @@ namespace Sevomin.Models.Helpers |
|
|
|
public Dictionary<string, string> Parameters { get; set; } |
|
|
|
public EmailType EmailType { get; set; } |
|
|
|
private string EmailFolderPath; |
|
|
|
private string EmailConfirmationFilePath; |
|
|
|
private string NewPasswordFilePath; |
|
|
|
private string EmailConfirmationFilePath; |
|
|
|
private string PasswordResetFilePath; |
|
|
|
private string ExpiringJobFilePath; |
|
|
|
private string NewJobFilePath; |
|
|
@ -34,16 +33,13 @@ namespace Sevomin.Models.Helpers |
|
|
|
EmailFolderPath = Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~/app_data"), "emails"); |
|
|
|
if (!Directory.Exists(EmailFolderPath)) |
|
|
|
throw new ApplicationException("Emails folder does not exist in the right address."); |
|
|
|
EmailConfirmationFilePath = Path.Combine(EmailFolderPath, "email-confirmation.html"); |
|
|
|
NewPasswordFilePath = Path.Combine(EmailFolderPath, "new-password.html"); |
|
|
|
EmailConfirmationFilePath = Path.Combine(EmailFolderPath, "email-confirmation.html"); |
|
|
|
PasswordResetFilePath = Path.Combine(EmailFolderPath, "password-reset.html"); |
|
|
|
ExpiringJobFilePath = Path.Combine(EmailFolderPath, "expiring-job.html"); |
|
|
|
NewJobFilePath = Path.Combine(EmailFolderPath, "new-job.html"); |
|
|
|
NewApplicationFilePath = Path.Combine(EmailFolderPath, "new-application.html"); |
|
|
|
if(!File.Exists(EmailConfirmationFilePath)) |
|
|
|
throw new ApplicationException("Email confirmation template does not exist in the right address."); |
|
|
|
if (!File.Exists(NewPasswordFilePath)) |
|
|
|
throw new ApplicationException("New password template does not exist in the right address."); |
|
|
|
throw new ApplicationException("Email confirmation template does not exist in the right address."); |
|
|
|
if (!File.Exists(PasswordResetFilePath)) |
|
|
|
throw new ApplicationException("Password reset template does not exist in the right address."); |
|
|
|
if (!File.Exists(ExpiringJobFilePath)) |
|
|
@ -74,11 +70,7 @@ namespace Sevomin.Models.Helpers |
|
|
|
case EmailType.PasswordReset: |
|
|
|
template = |
|
|
|
File.ReadAllText(PasswordResetFilePath, Encoding.UTF8); |
|
|
|
break; |
|
|
|
case EmailType.NewPassword: |
|
|
|
template = |
|
|
|
File.ReadAllText(NewPasswordFilePath, Encoding.UTF8); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case EmailType.ExpiringJob: |
|
|
|
template = |
|
|
|
File.ReadAllText(ExpiringJobFilePath, Encoding.UTF8); |
|
|
|