Mailer Template in Database

Shopify uses Liquid for this. It's simple to use, and you don't have
the danger of users entering any valid ruby code that gets blindly
evaled.

http://www.liquidmarkup.org/