You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use ASP MVC Postal in a background job to send emails as follows:
`public void CommentCreated(Comment comment, ApplicationUser user)
{
var viewsPath = Path.GetFullPath(HostingEnvironment.MapPath(@"~/Views/Emails"));
var engines = new ViewEngineCollection();
engines.Add(new FileSystemRazorViewEngine(viewsPath));
var emailService = new Postal.EmailService(engines);
var email = new CommentCreatedEmail
{
To = user.Email,
From = ConfigurationManager.AppSettings["SmtpEMailFrom"],
Subject = "Comment Created"
Comment = comment,
User = user
};
emailService.Send(email);
}`
But I'm getting the following error:
`Exception thrown: 'RazorEngine.Templating.TemplateCompilationException' in RazorEngine.dll
Exception thrown: 'System.Web.HttpCompileException' in System.Web.dll`
My view is as follows:
`@model MyApp.Models.CommentCreatedEmail
To: @Model.To
From: @Model.From
Subject: @Model.Subject
<p>
<a href="@Url.Action("Details", "Comment", new { id = @Model.Comment.Id }, "http")">@Url.Action("Details", "Comment", new { id = @Model.Comment.Id }, "http")</a>`
Any ideas?
The text was updated successfully, but these errors were encountered:
I'm trying to use ASP MVC Postal in a background job to send emails as follows:
But I'm getting the following error:
My view is as follows:
Any ideas?
The text was updated successfully, but these errors were encountered: