Skip to content
A wrapper around nodemailer used for sending email using handlebars templates.
JavaScript HTML
Find file
Latest commit 6c627fb Apr 26, 2015 @lupomontero clean up readme
Failed to load latest commit information.
test remove silly streaming interface and clean up Apr 26, 2015
Gruntfile.js Removing reference to old bin file Feb 25, 2014



Build Status Dependency Status devDependency Status

horseshoe is a mailer module for node.js. It provides a wrapper around nodemailer used for sending email using handlebars templates.

horseshoe is designed for a very specific use case. We use it at ENOISE to send out system emails using SMTP and Amazon SES. This emails are predesigned using handlebars templates and then rendered and sent using this module.

horseshoe renders templates using the data specified in the message object:

var message = {
  to: '',
  template: 'users-signup',
  data: { user: { firstname: 'Lupo' } }

horseshoe will search the templates path for files with either a .txt or .html extension (users-signup.txt and users-signup.html in this case) and render them using handlebars to create the email body.

horseshoe exports a single function. You invoke this function to get a mailer object that you can the use to send a message with mailer.send().

horseshoe will retry to send individual emails if they fail (up to 3 times).


Let's assume that your script is myscript.js and you have a directory called mail_templates in the same location containing a template called users-signup.txt (relative to script: mail_templates/users-signup.txt).

In myscript.js:

var horseshoe = require('horseshoe');
var mailer = horseshoe('Sendmail', { tmplPath: __dirname + '/mail_templates/' });
var message = {
  to: '',
  template: 'users-signup',
  data: { user: { firstname: 'Lupo' } }

mailer.send(message, function (error, response) {
  if (error) {
    // handle error

The mail_templates/users-signup.txt template:

This is a test subject

Hey {{user.firstname}},

I hope you like my test email...


Supported transports

horseshoe passes its options to nodemailer and so you can use all transports supported by nodemailer.

For more info see nodemailer's README.

Sendmail example

var mailer = require('horseshoe')('Sendmail', {
  path: "/usr/local/bin/sendmail",
  args: ["-f"]


var mailer = require('horseshoe')('SMTP', {
  sender: 'Someone <>',
  host: '',
  port: 587,
  auth: {
    user: '',
    pass: 'somepassowrd'

Amazon SES

var mailer = require('horseshoe')('SES', {


Note that you need to enable SMTP on and then use our API key both as username and password.

More info here:

var mailer = require('horseshoe')('SMTP', {
  service: 'Postmark',
  auth: {
Something went wrong with that request. Please try again.