RazorMailer - A Simple .NET Email Framework Using Razor Templates

After a considerable amount of effort (a lot more than I realised), RazorMailer is ready to be released under version 1.0.0.

RazorMailer is a .NET based email framework that uses Razor templates (and RazorEngine under the hood) to generate and send .NET MailMessages. It was created because the other .NET Email frameworks out there are either out of date (e.g. MvcMailer) or overly complex for such a simple task (e.g ActionMailerNext).

As of this writing, it’s successfully delivering email on two platforms; one at the startup I work for, Moneybox, and the other being my personal project, CompareVino. These two platforms give coverage over ASP.NET MVC, NancyFX, a console application and a batch processing framework called Hangfire. This more than satisfies the original project goal of creating a simple .NET component that is able to send emails independent of the framework it is running within.

As of version 1.0.0, RazorMailer supports:

  • Model based Razor templates (including layouts)
  • Template caching
  • Attachments
  • Unit testing
  • 3rd party SMTP relays (via an extensible dispatching interface)

I've always maintained that a core pillar of successful open source projects is in its documentation. With that in mind, I've set out to provide detailed documentation on how to implement and test RazorMailer within an application as well as provide the sample application that the snippets in the README were taken from. This should hopefully reduce the time taken to integrate RazorMailer into an application and prevent people from having to dig through source code to find out how to use it!

This is my first foray into open source and its certainly been an eye opener into the effort involved into turning a couple of classes within an application into an independent, well documented project. You can't help but admire those working on larger open source projects - it's certainly a labour of love.

Author image
About Jon Leigh
London Website

Hi, I'm Jon. I'm part of the Engineering team at Moneybox, a London based Fintech startup helping people to save and invest.

In my spare time, I've created CompareVino, a UK supermarket wine comparison website. If you like wine and buy it from a supermarket, you should definitely check it out.

If you want to get in touch, send me a message via Twitter