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
Feathers mailer service using
nodemailer
Installation
npm install feathers-mailer --saveIf using a transport plugin, install the respective module.
API
import Mailer from 'feathers-mailer'
mailer = Mailer(transport, defaults)
transportcan be either SMTP options or a transport plugin with associated options.defaultsis 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.

