Skip to content

Instantly share code, notes, and snippets.

View GiriVakkalanka's full-sized avatar

Giri Vakkalanka GiriVakkalanka

  • New York, NY
View GitHub Profile
@GiriVakkalanka
GiriVakkalanka / Mailer.js
Created August 1, 2017 17:29
SendGrid setup
const sendgrid = require('sendgrid');
const helper = sendgrid.mail; //don't want to use es6 destructuring b.c we want to call it helper. not mail.
const keys = require('../config/keys');
class Mailer extends helper.Mail {
//constructor doesnt need to receive a survey model obj.
//It just has to be an object that has a subject and recipients.
//the second parameter is the html string, that we'll call content
//this design lets us use this Mailer for sending more than just surveys
//this mailer obj is defined here created in the surveyRoutes to send the emails.