Skip to content

Instantly share code, notes, and snippets.

@evantahler
Last active July 23, 2020 18:21
Show Gist options
  • Save evantahler/a55a2e6b192134faaa90c29157721388 to your computer and use it in GitHub Desktop.
Save evantahler/a55a2e6b192134faaa90c29157721388 to your computer and use it in GitHub Desktop.
simple sending email service in actionhero
var nodemailer = require('nodemailer');
module.exports = {
initialize: function(api, next){
api.email = {
transporter: nodemailer.createTransport('smtps://user%40gmail.com:pass@smtp.gmail.com'),
send: function(to, subject, body, callback){
var payload = {
from: '"Fred Foo 👥" <foo@blurdybloop.com>',
to: to,
subject: subject,
html: body
};
api.email.transporter.sendMail(payload, callback);
}
};
next();
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment