Email Template
An Email Template is reusable email content — subject and body with Jinja placeholders that get filled in when the template is used. Saves you writing the same email five times a day.
Creating one
Email Template → New:
| Field | Notes |
|---|---|
| Name | Human-readable identifier |
| Subject | The email subject — supports Jinja: Reminder: Invoice {{ doc.name }} is overdue |
| Response | The body in HTML or plain text |
| Reference DocType | Optional — bind the template to a specific DocType so the editor knows what doc.* fields are available |
| Use HTML | Toggle for HTML vs plain text body |
Jinja in templates
Both Subject and Response support Jinja interpolation:
<p>Dear {{ doc.customer_name }},</p>
<p>Your invoice <strong>{{ doc.name }}</strong> for
{{ frappe.format_value(doc.grand_total, "Currency") }}
was due on {{ frappe.format_value(doc.due_date, "Date") }}.</p>
<p>Please remit payment at your earliest convenience.</p>
Available context:
doc— the document (when sent from a document)frappe— utility module (formatters, get_value, etc.)- Standard Jinja filters:
upper,lower,replace,default, etc.
Where templates are used
| Place | How |
|---|---|
| Document → Email button | When composing an email from a document form, click "Template" to insert one |
| Notifications | A Notification can reference an Email Template instead of inline content |
| Bulk email | When emailing many records (e.g., overdue invoice batch), pick a template once for all |
| API | Programmatically via frappe.sendmail(template="My Template", args={...}) |
Email Template vs Print Format
Email Templates are for email bodies — text that goes in the message. Print Formats are for attachments — PDF rendering of the document. The two often go together: an invoice email uses the "Invoice Reminder" Email Template for the body and the "Standard Invoice" Print Format for the attached PDF.
Languages
You can have one Email Template per language. The Notification or sender picks the version matching the recipient's language field. Useful for multilingual customer bases — see Translations & i18n.
Best practices
- Keep templates short; long emails get marked as spam
- Use HTML for branded customer emails, plain text for internal staff alerts
- Test by sending to yourself before going live (
frappe.sendmail(recipients="me@x.com", template="X", args=test_doc)) - Version templates in your head — when you change wording, sent emails before that point still used the old version