Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

nodemailer-sailthru-transport

1.0.0 • Public • Published

nodemailer-sailthru-transport

Build Status NPM version

Usage

Sailthru doesn't provide a generic endpoint to send emails, so you must create a a template using custom Zephyr template variables.

nodemailer-sailthru-transport passes {subject} and {html} as Zephyr variables which correspond to the subject and html options when using Nodemailer's sendMail function.

By default, nodemailer-sailthru-transport will use a template named nodemailer-sailthru-transport, but you can pass in a template when creating the transport. You can also pass a template on a per-sendMail basis by simply using template option.

Example

'use strict';
 
var nodemailer = require('nodemailer');
 
var sailthruTransport = require('sailthru-transport');
 
var transport = nodemailer.createTransport(sailthruTransport({
  auth: {
    apiKey: 'key',
    apiSecret: 'secret'
  },
  template: 'my-template'
}));
 
transport.sendMail({
  to: 'user@example.com',
  subject: 'Hello',
  html: '<p>How are you?</p>'
}, function(err, info) {
  if (err) {
    console.error(err);
  } else {
    console.log(info);
  }
});

install

npm i nodemailer-sailthru-transport

Downloadsweekly downloads

5

version

1.0.0

license

ISC

repository

githubgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar