public EmailMessage CreateEmailMessage(EmailView emailView) { var renderer = GlobalConfiguration.Configuration.DependencyResolver.GetService <IEmailViewRenderer>(emailView.RendererName); var rawEmailString = renderer.Render(emailView); var result = EmailParser.CreateMailMessage(rawEmailString); result.Body = ToSingleLine(result.Body); return(result); }
public string Render(EmailView email, string viewName = null) { viewName = viewName ?? email.ViewName; var controllerContext = CreateControllerContext(); var view = CreateView(viewName, controllerContext); var viewOutput = RenderView(view, email.ViewData, controllerContext); return(viewOutput); }
public EmailView CreateEmailView(string viewName, object model = null) { var email = new EmailView(viewName, model); return(email); }