Skip to content

Instantly share code, notes, and snippets.

@elbuo8
Created January 11, 2015 17:37
Show Gist options
  • 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('[email protected]');
email.setFrom('[email protected]');
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