email-templates
Create, preview (browser/iOS Simulator), and send custom email templates for Node.js. Made for @forwardemail, @ladjs, @cabinjs, @spamscanner, and @breejs.
Email Templates is a Node.js package for creating, previewing, and sending HTML emails using template files. It is built on top of Nodemailer, the standard Node.js email-sending library, and adds a layer for managing reusable templates and rendering them before sending.
You organize email content as template files inside named folders. Each folder holds the HTML template, an optional plain-text version, and a subject line template. By default the package uses Pug as the templating language, where you write HTML with variables that get filled in at send time, but you can swap in other template engines like EJS. You pass local variables to the send call, and the package renders them into the template before handing the result to Nodemailer.
One useful feature in development is automatic email previewing. When you run your application with the development environment flag set, the package renders each outgoing email to a temporary file and opens it in your browser automatically, so you can check layout without actually sending anything. You can configure it to open in a specific browser if needed.
CSS inlining is built in via the Juice library. You link a stylesheet in your template, mark it with a data attribute, and the package converts those external styles into inline styles before sending. This matters for email clients that strip out style blocks.
Other features described in the README include: file attachments, localization for multilingual emails, text-only email output, subject line prefixes, and the ability to load template content from a database instead of the file system.
The README also contains a full changelog of breaking changes across major versions going back to version 3, which is useful if you are upgrading an existing installation. The full README is longer than what was shown.