# Creating email templates

Email templates are a fundamental part of EmailJS, allowing you to define the settings and content of every email your application sends.

Each email template consists of key fields such as the subject, email body, recipient address, and other important details. These fields determine the core structure of the email, while dynamic variables allow for personalization by inserting data from your application at runtime. This makes it possible to create highly customized messages without manually crafting each one.

# Adding Dynamic Content

One of the most powerful aspects of EmailJS templates is their ability to use dynamic variables. These variables are replaced with real values when the email is sent, making it possible to insert a user's name, order details, or any other relevant information. For example, instead of writing a static greeting like "Hello, user," you can use a variable to personalize it:

Hello, {{name}} 

When sending the email, your application provides the actual data, making each message feel more relevant to the recipient. More details on how to implement this can be found in our guide on Dynamic Variables in Templates.

# Building and Testing Your Template

Creating a new email template in EmailJS is a straightforward process. The Email Templates (opens new window) section in the dashboard allows you to set up a new template by choosing a pre-built template, which you can then edit or fully customize to suit your needs.

EmailJS offers multiple ways to test your templates:

  • The "Test It" dialog allows you to preview and send a sample email.
  • The auto-generated JSFiddle provides a hands-on environment where you can see how the template interacts with actual data and test email delivery.

This streamlined approach helps developers and non-technical users alike validate their templates before integrating them into their applications.

# Template Size and Content Guidelines

While email templates are flexible, they do have some limitations.

Each template can accommodate up to 50,000 characters, which should be sufficient for most use cases. Excessively large templates will be ignored by the system to maintain performance and reliability.

For emails that require images, embedding them directly into the template is not recommended. Instead, EmailJS supports embedded attachments, which allow images to be included without bloating the template size.

# Conclusion

Email templates in EmailJS provide a structured and efficient way to manage transactional and automated emails. With support for dynamic content, testing tools, and flexible formatting, they offer a reliable solution for businesses and developers alike. By following best practices—such as keeping templates concise, using variables effectively, and embedding images properly—you can create high-performing emails that enhance user communication.