Skip to main content

Editable emails templates

Rails β€’ Asked by Karim Tarek

Hi there πŸ‘‹
I need users to be able to edit email templates, something like:
Hello {{ first_name }},
Please advice, thanks πŸ‘


This is a pretty large project :) I assume you want a model called email_templates. Then I think you want a "rich_text_field" with name body_html (or similar). Then you will want to use something like the liquid templating language to parse and replace {{ variable_name }} when rendering said template.

Resources


If you are just letting them change a few things like the subject, maybe disclaimer text, etc you can probably get by with a user_email_templates table with columns that map to those variables. Then when you go to send the email...simply load the template and inject the variables (with erb)


Thanks Casey πŸ‘
Those are the same resources that I manged to find. They are outdated so I thought maybe there are newer resources I'm not able to find, for example "effective_email_templates" gem is no longer maintained.


You are most welcome. The resources I listed are not recommendations to install and use :) They are reference material so you can see examples of how others have done similar tasks concretely and with documentation. The idea being if you need to rebuild all or a portion of those solutions you have some pretty solid inspiration.


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 27,623+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.