feathers-mail
v1.0.2
Published
Feathers Mail Service and Hooks
Maintainers
Readme
feathers-mail
Simple Feathers mailer service using
nodemailerFor security, the Mail service has been set up to only work internally. The service is named _mailer
Installation
npm install feathers-mail --saveHow to use
In your config file (eg config/default.json) add
"feathers-mail": {
"from": "[email protected]",
"smtp": {
"host": "smtp.host.here",
"secure": true,
"auth": {
"user": "[email protected]",
"pass": "replacewithpassword"
}
}
}More smtp settings available here https://nodemailer.com/smtp/
####Install plugin
// mailer plugin
app.configure(require('feathers-mail'));This can be done in either
- app.js after "app.configure(channels);"
- in any class or service where app. is available.
if you define the service multiple times, it will ignore the duplicates
Example usage
try {
await app.service('_mailer').create({
from: "[email protected]",
to: "[email protected]",
subject: "Message title",
text: "Plaintext version of the message",
html: "<p>HTML version of the message</p>"
});
} catch (error) {
//do something with error
}Node Mailer message settings https://nodemailer.com/message/
License
Copyright (c) 2020
Licensed under the MIT license.
