In related news, if you're using ASP.NET MVC, there is a way to use the familiar Razor templating engine to template your emails (or anything else, really). To do that you just need to install RazorEngine ( http://razorengine.codeplex.com/ ) - it exposes Razor in a way that it can be used for things other than rendering pages.
Here's how I use it right now:
string templateFile = HttpContext.Current.Server
.MapPath("~/App_Data/InviteUser.cshtml");
string template = System.IO.File.ReadAllText(templateFile);
var model = new
{
inviterName = "A user",
inviterEmail = inviterEmail,
manufacturerName = inviterMfr,
UserId = person.PrimaryEmail,
UserPassword = person.GeneratedPassword,
};
var bodyHtml = RazorEngine.Razor.Parse(template, model);
And the template: <html>
<body>
<p>
@Model.inviterName (@Model.inviterEmail)
@if (Model.manufacturerName != null)
{
<span>on behalf of <b>@Model.manufacturerName</b></span>
}
is inviting you to explore Mercury Catalog by AmpTab - the best furniture catalog app for the iPad:
</p>
[SNIP-SNIP]