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
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. |