When it comes to e-mails, nopCommerce has a very flexible Message Templates system to render e-mails by replacing what are called Tokens with actual values. For example, %Customer.FullName% will be replaced by a customer's full name.
While nopCommerce's Message Templates system is flexible enough to handle most scenarios (version 3.50 even supports attaching a static file), there are at least 2 deficiency with the implementation:
- Conditional rendering (if... then... else...) is not allowed
- Common layout has to be copied over to each and every Message Templates
To overcome these shortcomings, we can make use of Microsoft's powerful rendering engine - Razor. I believe most MVC developers are vary familiar with Razor syntax.
Below I'll show a proof-of-concept of using Razor engine to render Message Templates.