The Email Template System

With an email template system, you can give your users complete control over the email content sent by your application. Using Liquid, your users can use dynamic content within their email’s body, which is sometimes called “Merge tags” by the large email marketing companies.

Out of all of the uses I’ve seen with Liquid, this is by far the most popular. Lots of applications that only send emails have this type of system since this is the experience their users expect.

There are a lot of benefits for your application to have its own Email Template System.

  • Allows your users to customize the default emails that are being sent from your application. This can include branding, personalized copy, etc. As a software engineer myself, I have vastly underestimated the value of personalizing emails in the past. Emails are important. Customers that I have worked with care highly about what is being sent to their users and how often.
  • Increases the value perception of your company’s product. At one of my old jobs, we used to ask ourselves “How can we make this product look expensive?”. Adding more functionality to your application is one way to help your customers see more value.
  • Makes your emails dynamic using Liquid! Emails that are personalized have a higher chance of being read and for users to take the action that you want. Users can customize their emails using the same Liquid tags that they’re already used to since it is used throughout your application. They’re not learning an additional system.
  • Have complete control over your email system. If things go wrong, and that never happens, it’s good to have complete control over your system so that you can address anything customers are unhappy about. I’ve gotten some weird requests in the past that without complete control would be hard to fulfill. At the end of the day, you need to keep your customers happy after all.

One huge advantage to having this system is that it will work with the other three building blocks. Think of the Rule system. With an Email Template system, now you can have an “Email” action that automatically works with Custom Fields and Conditions. If your customer wants a custom email to be sent at any time, this is instantly possible. The data will flow through the Rule system and be used to render the email that is sent.

Ultimately, this final building block achieves the same goal as the previous three. A clear separation of responsibility between your software engineering team and the configuration team. How many times has your engineering team gone into emails to make minor copy changes? You don’t want your expensive engineers doing this kind of work! Give your configuration team the tools that they need to make customer changes themselves.


Example Email Template System

Here is an example of what an email template system may look like:


Your email template editor should have a few fields (probably exactly what you would expect):

  • A “From” field, which is the email address where emails from your system will be sent from. Keep in mind, you must send from your own domain name, unless you have specifically configured other domain names with DNS settings.
  • A “to” field where the email address to send to will be populated.
  • Subject and email body content. Using a WYSIWYG editor for your email content is a great idea and will allow your team to build some pretty incredible emails. I’ve always been surprised at what you can pull off when you have some time to put into it.

My recommendation for your system is that every field should allow for Liquid to be entered. When the application sends the email, every field can be parsed and rendered with Liquid, even if no dynamic variables were entered (or even if you don’t think anyone will ever need Liquid in that field). It can be an abstract thing to wrap your mind around at first, but even a “constant” string with no dynamic variables can still be rendered as Liquid. For example, in the string:


“Hello Adam,”


There is no dynamic content with {{ }} tags. However, you can still render this using Liquid, which would do nothing and return the same text. This is a nice hack to keep in mind. Rendering with Liquid is extremely fast, and it is always a nice surprise when you’re trying to solve a weird customer ask in the future and things just work because you planned ahead and made everything work the same way.

A “War” Story

When I think about Email Template editors, I always think back to an instance when there was an upset customer because their email didn’t look exactly how they wanted. This customer was a “whale” for us, so obviously it was important to keep them happy.

The customer had an image banner across the top of their email, but they didn’t like how wide it was. They demanded that it was exactly 6 inches! So, our configuration team went into the email editor, got their ruler out from their desk drawer, and made the change while holding their ruler up to the monitor to measure it out perfectly. Our team had a laugh and the customer was happy.

Beyond Email Templates

This last building block, the Email Template System, is just one example of what is possible with Liquid now that you have the Custom Field, Condition, and Rule systems. The possibilities are truly endless about what actions you can allow your configuration team to have, although I would recommend you base your actions and roadmap on customer demand. Keep in mind, Liquid can make any document be data driven. Some obvious other actions to build out may include: SMS capabilities, Twitter, HTTP Web Requests, etc.

When you make decisions in a way where you’re dividing responsibilities among your team, you’re building for the long-term. It might be more work and effort up front, but your effort will pay off when a new customer is onboarded and the development team doesn’t have to lift a finger. At my last job, we called this “Having exponential impact”. When a new customer comes on board and you don’t do anything, it’s not because you’re lazy. It’s because you already did that work, and now your code is working for you.