Skip to content

Instantly share code, notes, and snippets.

@akbsteam
Created February 25, 2013 12:16
Show Gist options
  • Save akbsteam/5029453 to your computer and use it in GitHub Desktop.
Save akbsteam/5029453 to your computer and use it in GitHub Desktop.
Parse.Cloud.define("hello", function(request, response) {
var sendgrid = require("sendgrid");
sendgrid.initialize("USERNAME", "PASSWORD");
var name = request.params.name;
var email = request.params.email;
var phone = request.params.phone;
sendgrid.sendEmail({
to: "USER@DOMAIN.COM",
from: email,
subject: "Contact Form",
text: "Name: "+name+"\nEmail: "+email+"\nPhone: "+phone
}, {
success: function(httpResponse) {
console.log(httpResponse);
response.success("Email sent!");
},
error: function(httpResponse) {
console.error(httpResponse);
response.error("Uh oh, something went wrong");
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment