MVC render action to string - Email templatingAdd to My Brief

Josh Doolan | 18/11/2011

A lot our clients require managed email templates.

Existing approaches involved tedious replacement tokens however a new approach that is possible in mvc; is to use strongly typed razor scripts  that are then serialized to a string – which you then attach as your email body.

This little helper function is really all you need: 

 

From here you can setup your model up with all your desired dynamic fields; saving hours over the old methods that are still in existence.

 

tags: Web Development

Interested in learning more?

Wiliam is a leading supplier of web solutions and can provide expert advice to assist your business or organisation online.

Make enquiry   Request quotation

Comments

Share this page

Print this page Email this page to a friend Bookmark and Share

No Brief added yet.

My Brief results-driven approach emphasises a commitment to our clients needs through strategic analysis and best-practice.

Add to My Brief

Click on this icon to save item into My Brief. Retrieve, email and print

Drag & Drop

Drag & drop any iten with this icon into My Brief. Retrieve, email and print

Search Blogs