JSPM

@stoplight/feathers-mailer

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q12697F
  • License MIT

Feathers mailer service

Package Exports

  • @stoplight/feathers-mailer

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@stoplight/feathers-mailer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

feathers-mailer

Build Status Code Climate Test Coverage Dependency Status Download Status Slack Status

Feathers mailer service using nodemailer

Installation

npm install feathers-mailer --save

If using a transport plugin, install the respective module.

API

import Mailer from 'feathers-mailer'

mailer = Mailer(transport, defaults)

  • transport can be either SMTP options or a transport plugin with associated options.
  • defaults is an object that defines default values for mail options.

mailer.create(body, params)

mailer.create is a thin wrapper for transporter.sendMail, accepting body and returning err and info.

See here for possible fields of body.

Example

import Mailer from 'feathers-mailer'
import mandrill from 'nodemailer-mandrill-transport'

// Register the service, see below for an example
app.use('/mailer', Mailer(mandrill({
  auth: {
    apiKey: process.env.MANDRILL_API_KEY
  }
})));

// Use the service
var email = {
   from: 'FROM_EMAIL',
   to: 'TO_EMAIL',
   subject: 'Sendgrid test',
   html: 'This is the email body'
};

app.service('mailer').create(email).then(function (result) {
  console.log('Sent email', result);
}).catch(err => {
  console.log(err);
});

For a more complete example, see examples/app which can be run with npm run example.

Changelog

1.0.0

  • Initial release

License

Copyright (c) 2016

Licensed under the MIT license.