Templates 🎨
Imagine your designer builds a beautiful welcome email. You don’t want to hardcode that HTML into your app — and you definitely don’t want to redeploy every time someone wants to change the wording. That’s what templates are for. Design it in the Mailofly dashboard, give it an ID, and your code just says “send the welcome template to this person with their name filled in.” Done.Why use templates?
- Your designers and marketers can update copy without you having to touch a line of code or redeploy
- Consistent styling — headers, footers, fonts, and brand colors stay the same across all your emails
- Dynamic personalization — swap in any data like
{{first_name}},{{order_id}}, or{{plan_name}}at send time - Safe editing — make changes in draft mode and preview them before going live
Using a template from your code
Instead of passing raw HTML, pass atemplate_id and the variables you want to fill in:
{{variables}}, and sends a beautiful personalized email. Your code never needs to know what the HTML looks like.
Where to go next
- Create & manage templates — build your first template
- Template editor guide — learn the editor features
- Variables & personalization — all the merge tag tricks
- Preview & test — make sure it looks right before sending
