mlandauer / cuttlefish

Transactional email server with a lovely web interface
http://cuttlefish.io
Other
1.53k stars 176 forks source link

Templating API #174

Open mlandauer opened 9 years ago

mlandauer commented 9 years ago

Some initial thoughts on why we would want to add a templating api to cuttlefish and how it might work:

If I'm sending email from my Ruby on Rails application (substitute your web framework of choice) I already have a templating solution for sending emails. Why would I want to move that to Cuttlefish?

The main reason that I can see is that in Cuttlefish we can then separate the presentation of the email from the underlying data. We could, for instance, have two versions of an email template and compare the click through rates for the different versions of the template. This isn't possible if all we have is the final email output rather than the template because an email with different data looks different. The only way we could do this if we tagged the email from the original application. This all feels a bit icky.

What if the templating worked as follows:

Instead of sending a final rendered email we send a template, with a template name, and data (as json) in a post to the API.

In cuttlefish it combines the template and the data and sends them off.

it also keeps a copy of the template around.

If you send another email with the same template it does the same but marks the new email as using the same template

If you send another email and the template has changed it saves it as a new "version" of the template.

Then, what you end up with is a connection between the template versions and the emails that were sent with each.

And all of this without having to explicitly manage template versions which seems like a complete nightmare.

Some additional things for the API:

jcklpe commented 6 years ago

I could be wrong but it sounds like the templates here you're talking about are more on the programmatic side of things with the API etc. By templates I was more thinking of a simple interface to write out a prewritten email that variables (like first or last name, the date, etc) could be logged. Mail Chimp has these for email campaigns, and Gmelius and MixMax use them on an individual basis in Gmail as browser extensions.

4n70w4 commented 4 years ago

+1 for email templates with variables