2013-11-30 18:14:29 +00:00
|
|
|
var config = require('../config/config.json');
|
|
|
|
var sendgrid = require('sendgrid')(config.sendgrid.user, config.sendgrid.password);
|
|
|
|
|
2013-11-19 19:33:11 +00:00
|
|
|
exports.getContact = function(req, res) {
|
2013-11-20 04:19:53 +00:00
|
|
|
res.render('contact', {
|
|
|
|
title: 'Contact',
|
2013-11-20 13:03:10 +00:00
|
|
|
user: req.user,
|
|
|
|
messages: req.flash('messages')
|
2013-11-20 04:19:53 +00:00
|
|
|
});
|
2013-11-19 19:33:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
exports.postContact = function(req, res) {
|
2013-11-30 07:30:00 +00:00
|
|
|
var firstName = req.body.firstName;
|
|
|
|
var lastName = req.body.lastName;
|
|
|
|
var email = req.body.email;
|
|
|
|
var body = req.body.contactBody;
|
2013-11-30 18:14:29 +00:00
|
|
|
|
|
|
|
sendgrid.send({
|
|
|
|
to: 'example@example.com',
|
|
|
|
from: 'other@example.com',
|
|
|
|
subject: 'Hello World',
|
|
|
|
text: 'My first email through SendGrid.'
|
|
|
|
}, function(err, json) {
|
|
|
|
if (err) { return console.error(err); }
|
|
|
|
console.log(json);
|
|
|
|
});
|
2013-11-19 19:33:11 +00:00
|
|
|
};
|