From cdcf5c5d46c0dd48d031f278e59a9bfc9c9ced03 Mon Sep 17 00:00:00 2001 From: Sahat Yalkabov Date: Sat, 30 Nov 2013 13:34:28 -0500 Subject: [PATCH] Sendgrid now uses a more sophisticated Email object rather than plain object (more flexible for sending complex email message) --- controllers/contact.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/controllers/contact.js b/controllers/contact.js index 10e66f1798..0790e51f73 100644 --- a/controllers/contact.js +++ b/controllers/contact.js @@ -11,20 +11,20 @@ exports.getContact = function(req, res) { }; exports.postContact = function(req, res) { - var firstName = req.body.firstName; - var lastName = req.body.lastName; - var email = req.body.email; + var from = req.body.email; var body = req.body.contactBody; var sendTo = 'sakhat@gmail.com'; var subject = 'API Example | Contact Form'; - sendgrid.send({ + var email = new sendgrid.Email({ to: sendTo, - from: email, + from: from, subject: subject, text: body - }, function(err, json) { + }); + + sendgrid.send(email, function(err) { if (err) { req.flash('error', err.message); return res.redirect('/contact');