I would like to inject content into emails from the database. I tried to do this in the View.
To: @ViewBag.To
From: lolcats@website.com
Subject: Important Message
Static Text
@Html.Raw(MvcApplication1.Data.Email.GetBlah())
@MvcApplication1.Data.Email.GetBlah()
The GetBlah just returns this for now.
public static string GetBlah()
{
return "Hello, my name is @ViewBag.Name";
}
And unsurprisingly the email sent just contains the text values and not merged.
Static Text
Hello, my name is @ViewBag.Name
Hello, my name is @ViewBag.Name
The reason I want to do this is because I have to make a publish every time I need to change content in emails plus I am going to need other languages too. So I just want the controller to decide what data to use and inject it to be merged at the time.
Is this possible with Postal? Can I create my own EmailViewRenderer and pass it along to be sent out?