Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nodemailer-express-handlebars

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodemailer-express-handlebars

A plugin for nodemailer that uses express-handlebars view engine to generate emails

  • 6.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
36K
decreased by-4.98%
Maintainers
1
Weekly downloads
 
Created
Source

Express Handlebars plugin for Nodemailer

This plugin works with nodemailer 6.x. And uses the express-handlebars view engine to generate html emails.

Install from npm

npm install nodemailer-express-handlebars

Usage

//reference the plugin
const hbs = require('nodemailer-express-handlebars');
//attach the plugin to the nodemailer transporter
transporter.use('compile', hbs(options));
//send mail with options
const mail = {
   from: 'from@domain.com',
   to: 'to@domain.com',
   subject: 'Test',
   template: 'email',
   context: {
       name: 'Name'
   }
}
transporter.sendMail(mail);

You can send a multipart html and text email by setting the text_template option on a mail message.

const mail = {
   from: 'from@domain.com',
   to: 'to@domain.com',
   subject: 'Test',
   template: 'email',
   text_template: 'text',
   context: {
       name: 'Name'
   }
}

Plugin Options

The plugin expects the following options:

  • viewEngine (required) either the express-handlebars view engine instance or options for the view engine
  • viewPath (required) provides the path to the directory where your views are
  • extName the extension of the views to use (defaults to .handlebars)

Mail options

Set the template and values properties on the mail object before calling sendMail

  • template the name of the template file to use
  • context this will be passed to the view engine as the context as well as view engine options see here

License

MIT

Keywords

FAQs

Package last updated on 12 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc