Created
October 4, 2017 17:13
-
-
Save zachary-russell/93dcc482b38d1c527adeddcd2ddb5ed9 to your computer and use it in GitHub Desktop.
Google Cloud Form Processing Script
This file contains hidden or 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 api_key = 'YOUR-KEY-HERE'; | |
var sending_domain = 'sandbox3d603fef70dc4a3db61d4f9de9854c46.mailgun.org'; | |
var mailgun = require('mailgun-js')({apiKey: api_key, domain: sending_domain}); | |
exports.processForm = function processForm(req, res) { | |
query = req.query; | |
var data = { | |
from: query.fname + ' ' + query.lname + ' <' + decodeURIComponent(query.email) + '>', | |
to: '[email protected]', | |
subject: 'New Submission From ' + query['fname'] + ' ' + query['lname'] , | |
text: decodeURIComponent(query.message) | |
} | |
console.log(query); | |
mailgun.messages().send(data, function (error, body) { | |
res.send(body); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment