A simple hapijs plugin for sending e-mails. Uses nodemailer.
const Respondence = require('respondence');
const server = new Hapi.Server();
await server.register({
plugin: Respondence,
options: {
smtp: 'smtps://user%40gmail.com:[email protected]'
}
});
const mail = {
from: '"Baroof" <[email protected]>',
to: '[email protected]',
subject: 'Foo',
text: 'A bar without foo is barfoo.'
},
try {
await server.plugins.respondence.send(internals.mail);
}
catch(err) {
console.log(err);
}
try {
await server.plugins.respondence.verify();
}
catch(err) {
console.log(err);
}
const Mailgun = require('nodemailer-mailgun-transport');
await server.register({
register: Respondence,
options: {
plugin: Mailgun,
params: {
auth: {
api_key: 'api-key1234567890',
domain: '1234567890.mailgun.org'
}
}
}
});
See more transport plugins here and nodemailer for more information.
- Include 100% test coverage.
- Follow the Hapi coding conventions
- Submit an issue first for significant changes.