Skip to content

Commit

Permalink
Upgrade to latest Sendgrid version (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ace Nassri authored and jmdobry committed Sep 13, 2016
1 parent 31e0341 commit 4693721
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
23 changes: 17 additions & 6 deletions appengine/sendgrid/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,23 @@ app.get('/', function (req, res) {

// [START hello]
app.post('/hello', function (req, res, next) {
Sendgrid.send({
from: SENDGRID_SENDER, // From address
to: req.body.email, // To address
subject: 'Hello World!', // Subject
text: 'Sendgrid on Google App Engine with Node.js' // Content
}, function (err) {
var sgReq = Sendgrid.emptyRequest({
method: 'POST',
path: '/v3/mail/send',
body: {
personalizations: [{
to: [{ email: req.body.email }],
subject: 'Hello World!'
}],
from: { email: SENDGRID_SENDER },
content: [{
type: 'text/plain',
value: 'Sendgrid on Google App Engine with Node.js.'
}]
}
});

Sendgrid.API(sgReq, function (err) {
if (err) {
return next(err);
}
Expand Down
4 changes: 2 additions & 2 deletions appengine/sendgrid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"body-parser": "^1.14.2",
"express": "^4.13.4",
"jade": "^1.11.0",
"sendgrid": "^2.0.0"
"sendgrid": "^4.0.1"
}
}
}

0 comments on commit 4693721

Please sign in to comment.