Sendgrid now uses a more sophisticated Email object rather than plain object (more flexible for sending complex email message)

This commit is contained in:
Sahat Yalkabov
2013-11-30 13:34:28 -05:00
parent b5fc4a024f
commit cdcf5c5d46

View File

@ -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');