10

I'm looking to create emails, mainly HTML, based on templates - I'd really like to do something like:

  1. Set up my template, as an HTML (or similar) file
  2. Include tags, that are then replaced with specific data (kind of like mail-merge....)

I've seen this: http://www.bitethebullet.co.uk/EmailTemplateFramework/tabid/58/Default.aspx

From searching on stack overflow, i understand nVelocity might be another option? But i can't find any examples to do what i want to do...

Any other suggestions?

Alex
  • 37,502
  • 51
  • 204
  • 332
  • duplicate: http://stackoverflow.com/questions/340095/can-you-recommend-a-net-template-engine – Mauricio Scheffer Sep 24 '09 at 13:33
  • 1
    Slightly different questions - this one is asking for a templating engine that specialises in email, the other for generic engines that can also handle email. – Spongeboy May 17 '12 at 06:55

2 Answers2

6

This kind of functionality is already built in. See MailDefinition class. For more complex scenarios you might want to consider something like NVelocity. I've had a lot of success with StringTemplate's C# port.

RichardOD
  • 28,883
  • 9
  • 61
  • 81
3

I've just released an open source project for precisely this purpose. You can read some more details and grab the source code from my blog.

http://thecodedecanter.wordpress.com/2010/07/19/town-crier-an-open-source-e-mail-templating-engine-for-net/

Oenotria
  • 1,692
  • 11
  • 24