Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@elbuo8
Created January 11, 2015 17:37
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 elbuo8/d370e4ef5bed75715f1d to your computer and use it in GitHub Desktop.
Save elbuo8/d370e4ef5bed75715f1d to your computer and use it in GitHub Desktop.
Parse sending
var sendgrid = require('sendgrid');
sendgrid.initialize('SENDGRID-USERNAME', 'SENDGRID-PASSOWORD');
var email = sendgrid.Email();
email.addTo('john@email.com');
email.setFrom('doe@email.com');
email.setSubject('Hello!');
email.setText('YAY');
email.addFilter("templates", "enabled", "1");
email.addFilter("templates", "template_id","the_code_of_the_needed_template");
sendgrid.sendEmail(email, {
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