4

Is there a way to email an ASP.NET View using the standard view engine (not spark)?

5 Answers 5

5

If by standard view engine you mean WebForms then you could take a look at this blog post. If by standard view engine you mean Razor you may take a look at the following blog post. You may also take a look at MvcContrib way of doing it. And also DotLiquid.

Sign up to request clarification or add additional context in comments.

Comments

5

Andrew Davey done a recent presentation on Generating email with View Engines at mvcConf 2.

You can find out more information about the open source Postal project he created from the Postal project site or download it via NuGet.

It allows you to generate emails from the Razor view engine as well as the WebForms view engine.

Comments

4

You might want to take a look at Postal and see if that works for you.

Comments

1

You can render a view to a string then send that as the body of your message using:

MailMessage message = new MailMessage ();
AlternateView htmlView = AlternateView.CreateAlternateViewFromString (htmlMessage, "text/html")
message.AlternateViews.Add (htmlView);

Comments

1

Did you take a look at MvcMailer? See the NuGet package here and the project documentation

Hope it helps!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.