3

I want to use Mailgun (or maybe Sendgrid) to send emails from my app.

This is pretty straightforward cause I can use RestSharp to interact with their api.

The problem lies in the fact that generating an HTML email is a PITA if I cant use razor. I know there are two nuget packages (Postal, MvcMailer) that handle this problem quite nicely but they force me to use a SMTP server and I dont want or need that at all.

I just want to keep using the Mailgun API to send emails but I want to have a way to generate the markup for those emails using Razor.

How can I do this?

Please Help.

nacho10f
  • 5,816
  • 6
  • 42
  • 73
  • possible duplicate of [ASP.NET MVC Razor: How to render a Razor Partial View's HTML inside the controller action](http://stackoverflow.com/questions/4344533/asp-net-mvc-razor-how-to-render-a-razor-partial-views-html-inside-the-controlle) – marcind Oct 10 '11 at 22:31

1 Answers1

5

If you have a partial you can render it to a string, as in the following SO question: link

Community
  • 1
  • 1
JP.
  • 5,536
  • 7
  • 58
  • 100