In AS:NET / Mono MVC2 method below form Render a view as a string is used to create html e-mail bodies.
Partiil view Order.ascx contains images like
<img width='20%' alt='' src='<%= Url.Action("Logo", "Store")%>' />
In Emails those images appear without site address like /Store/Logo
and thus images do not appear.
How to force image links to appear with absolute addresses like htttp:/Mysite.com/Store/Logo
or add site base address to html email body is this helps.
ASP.NET / Mono MVC2 , .NET 3.5, jquery, jquery ui are used.
Controller Action method:
var s = RenderViewToString<OrderConfirm>("~/Views/Checkout/Order.ascx", order);
public class ControllerBase : Controller
{
protected string RenderViewToString<T>(string viewPath, T model)
{
ViewData.Model = model;
using (var writer = new StringWriter())
{
var view = new WebFormView(viewPath);
var vdd = new ViewDataDictionary<T>(model);
var viewCxt = new ViewContext(ControllerContext, view, vdd, new TempDataDictionary(), writer);
viewCxt.View.Render(viewCxt, writer);
return writer.ToString();
}
}