Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade App Engine sample to latest Sendgrid version #212

Merged
merged 1 commit into from
Sep 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
}
}
}