Last active
July 10, 2018 17:45
-
-
Save sjmach/c7c328f958e7f61d405c954bf32d33a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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