Email Template
In ERPNext, you can change every email, but some standard messages, like quotes, invoices, reminders, and welcome emails, are often the same. You can use Email Templates, also known as Standard Replies, to make these emails the same every time instead of writing them by hand. This keeps things the same and saves time when you have to send the same message over and over again.
Organisations can do the following with Email Templates:
- Set up automatic, professional, and standardised responses.
- Keep the tone and style of the brand's communication the same.
- Cut down on mistakes and inefficiencies that come from typing by hand.
To get to the Email Template list, go to:
1. How to make an email template
Click New in the Email Template list to make a new template.
Give this email template a name.
For example, "Order Confirmation Template," "Payment Reminder Template," or "Welcome Email." This name makes it easy to find the template later when you need to send emails.
Fill in a Subject for the template.
When you use this template, this subject line will show up automatically. "Thank you for your order!"" or "Your Payment Receipt."
Answer: This is the main part of the email. Type in the standard message that should be sent when this template is used. You can make responses more personal by using field variables (see below).
For example, "Dear {{ customer_name }}, Thank you for your recent purchase..."
- To save your email template, click on Save.
The template is ready to use in system-generated emails or when you send emails by hand through ERPNext once you save it.
1.1 How to Use an Email Template
You can use your Email Template right away when you send emails from ERPNext:
- Look for the "CC, BCC & Email Template" section in the email composer window of any transaction, such as a sales order, invoice, or quotation.
- Choose your template from the Email Template drop-down menu.
- ERPNext will automatically get the Subject and Response (body content) from the template.
1.2 How to get field names
Fieldnames in ERPNext let you change your templates on the fly, just like placeholders or variables. These fieldnames get real data from the document when it is sent. - For example: If you type "Dear {{ customername }}," ERPNext will replace {{ customername }} with the real name from the sales order, invoice, or other document.
To find the right field names:
Click on Customise Form.
Choose the right DocType, like a Sales Order, Quotation, or Purchase Order.
Look over the fieldnames that are listed there.
In your email template, use these fieldnames inside double curly braces {{ }}.
Some common example variables are: - {{ customername }} - {{ duedate }} - {{ total_amount }} Each email feels like it's just for you because it uses fieldnames, even though it's sent from a standard template.
1.3 Making the template with HTML
ERPNext lets you write the body of your email template in two ways:
- Rich Text Editor (default): Good for simple formatting, like links, bullet points, and bold text.
- Editor for HTML Code: If you want more control:
- To switch to code view, check the Use HTML box.
- This lets you put HTML right into the body of your email.
- HTML templates let you customise things in more advanced ways: Using colours, tables, logos, and branding.
Using HTML tags to structure email content exactly.
This is especially helpful for:
- Making emails for marketing.
- Adding the company's brand.
- Using Jinja to create parts of the email body on the fly with loops and conditions.
1.4 Making templates
The Jinja Templating Engine is used by ERPNext to handle dynamic content in email templates. With Jinja:
- You can add variables on the fly ({{ }}).
- Do checks that depend on conditions ({% if %}).
- Use loops, like {% for item in items %}.
For example: - "Dear {{ customer_name }}" will put the customer's real name in. - You can go through invoice line items to show a table of products and services that changes over time. The Jinja Official Documentation has more information on how to make advanced templates with Jinja.