Skip to main content
All CollectionsPlugin QuestionsHelpers
(Plugin) How to save a template and get the code?
(Plugin) How to save a template and get the code?

In this article, we will guide you on how to save templates in the Plugin.

Valeriia avatar
Written by Valeriia
Updated over a week ago

The email templates that may be created/edited with Stripo editor consist of two separate parts: the HTML code and the CSS code.

These parts of one template should be stored in your own database separately and passed simultaneously via initialization when the user decides to edit the template.

Kindly take note that there are specific requirements for the code to be displayed properly. The code must include tags for both <head> and <body>. Also, it is required that the email template’s HTML code has at least one stripe with one structure in it.

If you want to offer your users the ability to create new email templates from scratch, you can utilize the pre-existing HTML and CSS code of an empty email template. You can find the code here.

Additionally, you can display some of Stripo's free email templates in the application for your users for inspirational purposes. Kindly be informed that the templates available in that location are limited. To access our entire collection of pre-designed templates, please reach out to our support team at

How to save created or edited email templates?

  • Design a button that aligns with the aesthetics of your website and position it on the top panel;

  • Call the "getTemplate" function and link it to the already created button.

This method takes out modified HTML and CSS from the editor in order to save them in your DB and later load them to the editor again.

The "getTemplate" function provides HTML and CSS codes along with internal styles and editor markup, which are necessary for re-editing the template using the Drag-and-Drop feature.

Format: callback(HTML, CSS, width, height).

Example of using:

document.querySelector('#getTemplateButton').addEventListener('click', function()
window.StripoApi.getTemplate(function(html, css) {
console.log(html, css);


As a result, I get modified HTML/CSS codes in the console:

Where exactly you will transfer the modified code depends on your needs. You can write the path leading to your database so that the modified HTML/CSS codes overlap the previous template code.

Thus, when you click on the "Save" button, you will always receive a new updated HTML/CSS code replacing the previous one.

Thank you for taking the time to read our articles. We hope you will find this information helpful.

If you have any additional questions, please email us at

We would be glad to talk with you.

Did this answer your question?