Skip to content

Instantly share code, notes, and snippets.

@sjmach
Last active July 10, 2018 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjmach/c7c328f958e7f61d405c954bf32d33a1 to your computer and use it in GitHub Desktop.
Save sjmach/c7c328f958e7f61d405c954bf32d33a1 to your computer and use it in GitHub Desktop.
var mailgun = require('mailgun-js')({apiKey: api_key, domain: domain});
exports.sendWelcomeEmail = functions.firestore.document('xxx/{userId}').onCreate(event => {
var user = event.data.data();
var name = user.Name;
var email = user.Email;
var data = {
from: ' App xxx',
subject: 'Welcome to Tools Android App!',
html: `HTML template`,
'h:Reply-To': 'noreply@xxx',
to: email
}
if( email ) {
mailgun.messages().send(data, function (error, body) {
console.log(body)
})
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment