Adds an email-templates collection where editors build emails from blocks such as heading, button, container, image, row, section and text. Templates support dynamic macros, localization and a device preview tab. HTML and plain text output is available through a REST endpoint or a local API function. Requires Payload 3.37 or newer.
A plugin for Payload CMS to create email templates based on React Email
Installation
npm i payload-email-template33
Stars
2
Forks
9
Open Issues
1 years ago
Last Updated
27
Weekly Downloads
v1.2.1
npm Version
330.0 KB
Unpacked Size
2
Dependencies
330 since Sep 7
| Date | Stars |
|---|---|
| Dec 6, 2026 | 33 |
| Dec 5, 2026 | 33 |
| Dec 4, 2026 | 33 |
| Dec 3, 2026 | 33 |
| Dec 2, 2026 | 33 |
| Dec 1, 2026 | 33 |
| Nov 30, 2026 | 33 |
| Nov 29, 2026 | 33 |
| Nov 28, 2026 | 33 |
| Nov 27, 2026 | 33 |
| Nov 26, 2026 | 33 |
| Nov 25, 2026 | 33 |
| Nov 24, 2026 | 33 |
| Nov 23, 2026 | 33 |
| Nov 22, 2026 | 33 |
| Nov 21, 2026 | 33 |
| Nov 20, 2026 | 33 |
| Nov 19, 2026 | 33 |
| Nov 18, 2026 | 33 |
| Nov 17, 2026 | 33 |
| Nov 16, 2026 | 33 |
| Nov 15, 2026 | 33 |
| Nov 14, 2026 | 33 |
| Nov 13, 2026 | 33 |
| Nov 12, 2026 | 33 |
| Nov 11, 2026 | 33 |
| Nov 10, 2026 | 33 |
| Nov 9, 2026 | 33 |
| Nov 8, 2026 | 33 |
| Nov 7, 2026 | 33 |
| Nov 6, 2026 | 33 |
| Nov 5, 2026 | 33 |
| Nov 4, 2026 | 33 |
| Nov 3, 2026 | 33 |
| Nov 2, 2026 | 33 |
| Nov 1, 2026 | 33 |
| Oct 31, 2026 | 33 |
| Oct 30, 2026 | 33 |
| Oct 29, 2026 | 33 |
| Oct 28, 2026 | 33 |
| Oct 27, 2026 | 33 |
| Oct 26, 2026 | 33 |
| Oct 25, 2026 | 33 |
| Oct 24, 2026 | 33 |
| Oct 23, 2026 | 33 |
| Oct 22, 2026 | 33 |
| Oct 21, 2026 | 33 |
| Oct 20, 2026 | 33 |
| Oct 19, 2026 | 33 |
| Oct 18, 2026 | 33 |
| Oct 17, 2026 | 33 |
| Oct 16, 2026 | 33 |
| Oct 15, 2026 | 33 |
| Oct 14, 2026 | 33 |
| Oct 13, 2026 | 33 |
| Oct 12, 2026 | 33 |
| Oct 11, 2026 | 33 |
| Oct 10, 2026 | 33 |
| Oct 9, 2026 | 33 |
| Oct 8, 2026 | 33 |
| Oct 7, 2026 | 33 |
| Oct 6, 2026 | 33 |
| Oct 5, 2026 | 33 |
| Oct 4, 2026 | 33 |
| Oct 3, 2026 | 33 |
| Oct 2, 2026 | 33 |
| Oct 1, 2026 | 33 |
| Sep 30, 2026 | 33 |
| Sep 29, 2026 | 33 |
| Sep 28, 2026 | 33 |
| Sep 27, 2026 | 33 |
| Sep 26, 2026 | 33 |
| Sep 25, 2026 | 33 |
| Sep 24, 2026 | 33 |
| Sep 23, 2026 | 33 |
| Sep 22, 2026 | 33 |
| Sep 21, 2026 | 33 |
| Sep 20, 2026 | 33 |
| Sep 19, 2026 | 33 |
| Sep 18, 2026 | 33 |
| Sep 17, 2026 | 33 |
| Sep 16, 2026 | 33 |
| Sep 15, 2026 | 33 |
| Sep 14, 2026 | 33 |
| Sep 13, 2026 | 33 |
| Sep 12, 2026 | 33 |
| Sep 11, 2026 | 33 |
| Sep 10, 2026 | 33 |
| Sep 9, 2026 | 33 |
| Sep 8, 2026 | 33 |
| Sep 7, 2026 | 33 |
28−42 since Sep 7
| Date | Weekly downloads |
|---|---|
| Dec 6, 2026 | 28 |
| Dec 5, 2026 | 8 |
| Dec 4, 2026 | 6 |
| Dec 3, 2026 | 6 |
| Dec 2, 2026 | 7 |
| Dec 1, 2026 | 17 |
| Nov 30, 2026 | 19 |
| Nov 29, 2026 | 23 |
| Nov 28, 2026 | 23 |
| Nov 27, 2026 | 23 |
| Nov 26, 2026 | 23 |
| Nov 25, 2026 | 23 |
| Nov 24, 2026 | 14 |
| Nov 23, 2026 | 13 |
| Nov 22, 2026 | 18 |
| Nov 21, 2026 | 24 |
| Nov 20, 2026 | 25 |
| Nov 19, 2026 | 26 |
| Nov 18, 2026 | 35 |
| Nov 17, 2026 | 35 |
| Nov 16, 2026 | 37 |
| Nov 15, 2026 | 30 |
| Nov 14, 2026 | 27 |
| Nov 13, 2026 | 26 |
| Nov 12, 2026 | 34 |
| Nov 11, 2026 | 26 |
| Nov 10, 2026 | 30 |
| Nov 9, 2026 | 27 |
| Nov 8, 2026 | 26 |
| Nov 7, 2026 | 29 |
| Nov 6, 2026 | 28 |
| Nov 5, 2026 | 20 |
| Nov 4, 2026 | 33 |
| Nov 3, 2026 | 29 |
| Nov 2, 2026 | 35 |
| Nov 1, 2026 | 43 |
| Oct 31, 2026 | 37 |
| Oct 30, 2026 | 38 |
| Oct 29, 2026 | 36 |
| Oct 28, 2026 | 21 |
| Oct 27, 2026 | 20 |
| Oct 26, 2026 | 15 |
| Oct 25, 2026 | 59 |
| Oct 24, 2026 | 90 |
| Oct 23, 2026 | 88 |
| Oct 22, 2026 | 92 |
| Oct 21, 2026 | 114 |
| Oct 20, 2026 | 116 |
| Oct 19, 2026 | 119 |
| Oct 18, 2026 | 65 |
| Oct 17, 2026 | 47 |
| Oct 16, 2026 | 62 |
| Oct 15, 2026 | 77 |
| Oct 14, 2026 | 63 |
| Oct 13, 2026 | 61 |
| Oct 12, 2026 | 57 |
| Oct 11, 2026 | 63 |
| Oct 10, 2026 | 56 |
| Oct 9, 2026 | 42 |
| Oct 8, 2026 | 24 |
| Oct 7, 2026 | 17 |
| Oct 6, 2026 | 24 |
| Oct 5, 2026 | 26 |
| Oct 4, 2026 | 21 |
| Oct 3, 2026 | 20 |
| Oct 2, 2026 | 25 |
| Oct 1, 2026 | 25 |
| Sep 30, 2026 | 28 |
| Sep 29, 2026 | 38 |
| Sep 28, 2026 | 37 |
| Sep 27, 2026 | 35 |
| Sep 26, 2026 | 33 |
| Sep 25, 2026 | 30 |
| Sep 24, 2026 | 31 |
| Sep 23, 2026 | 38 |
| Sep 22, 2026 | 33 |
| Sep 21, 2026 | 39 |
| Sep 20, 2026 | 87 |
| Sep 19, 2026 | 99 |
| Sep 18, 2026 | 131 |
| Sep 17, 2026 | 164 |
| Sep 16, 2026 | 217 |
| Sep 15, 2026 | 211 |
| Sep 14, 2026 | 206 |
| Sep 13, 2026 | 163 |
| Sep 12, 2026 | 166 |
| Sep 11, 2026 | 150 |
| Sep 10, 2026 | 130 |
| Sep 9, 2026 | 68 |
| Sep 8, 2026 | 65 |
| Sep 7, 2026 | 70 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1012168829-root)<a href="https://payloaddirectory.dev/plugins/1012168829-root"><img src="https://payloaddirectory.dev/badge/1012168829-root.svg" alt="Payload Directory"></a>README
A powerful, visual, and block-based email template builder plugin for Payload CMS — built on top of React Email. Design beautiful, dynamic, and localized email templates with ease! ✨
pnpm add payload-email-template
# or
yarn add payload-email-template
# or
npm install payload-email-template
Add the plugin to your Payload config in the plugins array:
import { emailTemplatePlugin } from 'payload-email-template'
export default buildConfig({
// ...other config
plugins: [
emailTemplatePlugin({
enabled: true,
imageCollectionSlug: 'media', // (optional) collection for image uploads
previewBreakpoints: [
// (optional) default breakpoints
{ name: 'mobile', label: 'Mobile', width: 375, height: 667 },
{ name: 'desktop', label: 'Desktop', width: 1440, height: 900 },
],
disableStyle: false, // (optional) allow custom style overrides, default: false
macros: {
// (optional) dynamic content for variables, functions, and config
variables: {
companyName: 'Your Company',
user: { firstName: 'John', lastName: 'Doe' },
},
functions: {
greet: (name) => `Hello, ${name}!`,
formatPrice: (price) => `$${price.toFixed(2)}`,
},
config: {
appName: 'My App',
version: '1.0.0',
},
},
// ...other options
}),
],
})


| Option | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true | Enable/disable the plugin |
imageCollectionSlug | string | 'media' | Collection slug for image uploads |
previewBreakpoints | array | see example | Device preview sizes for the preview tab |
disableStyle | boolean | false | Disable custom style overrides |
macros | object | {} | Dynamic content configuration (variables, functions, config) |
endpointAccess | Access | ({req}) => Boolean(req.user) | Default access control for the /api/email-templates/:id/generate endpoint |
collectionAccess | Access | { read: ({req}) => Boolean(req.user) } | Default access control for email-templates collection |
Configure blocks (Heading, Button, Container, etc.) to build your template. Each block has configurable fields (content, style, alignment, etc.). Blocks can be nested for complex layouts.
If you enable localization in your Payload config, the plugin will automatically make text-related template fields localizable.
The template can be previewed in the Preview tab. You can also use the controls to toggle mode, device, and zoom.
You can trigger rendering the email template by sending a POST request to the following endpoint:
POST /api/email-templates/:id/generate
You will receive both html and plainText versions of the template:
{
"html": "<html>...</html>",
"plainText": "..."
}
Then you can send it via your email provider.
It's also possible to render the email template by calling renderEmailTemplate directly in the back-end, skipping the http request in that case.
import { renderEmailTemplate } from "payload-email-template"
// const emailTemplate = await req.payload.find({
// collection: 'email-templates',
// ...
// })
const html = await renderEmailTemplate({
data: emailTemplate,
locale: 'en',
format: 'html',
macroContext: {
variables: { ... },
functions: { ... },
config: { ... }
}
})
The plugin supports powerful dynamic content through macros that can be used in email subjects, headings, and text blocks.
{{variableName}}Access data from your macro configuration:
{{companyName}} → "Acme Corporation"
{{user.firstName}} → "John"
{{@config('key')}}Access plugin configuration values:
{{@config('appName')}} → "My Awesome App"
{{@config('version')}} → "1.0.0"
{{@date('format')}}Format current date and time:
{{@date('YYYY-MM-DD')}} → "2024-01-15"
{{@date('MMMM Do, YYYY')}} → "January 15th, 2024"
Transform data with custom functions:
{{@uppercase('hello')}} → "HELLO"
{{@greet('John')}} → "Hello, John!" (if configured)
Show content based on conditions:
Repeat content for data collections:
✅ Email Subjects: "Welcome to {{companyName}}, {{user.firstName}}!"
✅ Heading Blocks: Mix text, links, and macros in headings
✅ Text Blocks: Inline macros alongside regular text and links
✅ Macro Blocks: Dedicated blocks for complex conditions and loops
You can also pass runtime macro context when generating emails:
// POST /api/email-templates/:id/generate
{
"macroContext": {
"variables": {
"user": { "firstName": "Jane" },
"orderTotal": "$99.99"
}
}
}
Runtime context takes precedence over plugin configuration.
Contributions are welcome! Please open issues or pull requests for bug fixes, features, or documentation improvements.
payload usesend
Payload email adapter that sends messages through the useSend API, formerly Unsend
82621/wk8v3 v4
payload order emails
Transactional emails on Payload order creation and status changes, with overridable templates
7333/wk1v3
eusend payload
Payload email adapter that sends transactional email through the eusend REST API from the EU
72230/wk1v3 v4
plugin emails
Transactional emails defined in code, with copy editors can change, preview and test-send from the admin.
7029/wk10v3
payload mailing
Template-based email with layouts, scheduling and job-queue delivery through Payload collections
68290/wk1v3
payload email ahasend
Email adapter that sends Payload CMS emails through the AhaSend API, with support for API v1 and v2
3927/wk1v3