Skip to content

Instantly share code, notes, and snippets.

@mlabouardy
Created October 26, 2017 13:23
Show Gist options
  • Save mlabouardy/9a12fe80c24bce47862d74995d653109 to your computer and use it in GitHub Desktop.
Save mlabouardy/9a12fe80c24bce47862d74995d653109 to your computer and use it in GitHub Desktop.
Send email with MailGun library
'use strict';
var mg = require('mailgun-js')({
apiKey: process.env.MAILGUN_API_KEY || 'YOUR_API_KEY',
domain: process.env.MAILGUN_DOMAIN || 'DOMAIN_NAME'
});
exports.sendEmail = function(event, context, callback){
mg.messages().send({
from: '[email protected]',
to: '[email protected]',
subject: 'Hello',
text: 'Sent from lambda on a defined schedule'
}, function(err, body){
callback(err, body)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment