diff options
| author | Adam Soltys <[email protected]> | 2016-09-22 10:11:19 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2016-09-22 10:11:24 -0700 |
| commit | acd47767d0c02dfa1a4152208a16c21255e4943b (patch) | |
| tree | 5614d2b68a094cad9b4bb15c1f9606e9626ef128 /routes/users.js | |
| parent | 515b1a63871af43fca536f0a1dd653dcaa1d2ba9 (diff) | |
| download | coinos-server-acd47767d0c02dfa1a4152208a16c21255e4943b.tar.gz coinos-server-acd47767d0c02dfa1a4152208a16c21255e4943b.zip | |
Upgrade sendgrid and fill in transaction details in notification email
Diffstat (limited to 'routes/users.js')
| -rw-r--r-- | routes/users.js | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/routes/users.js b/routes/users.js index 1449eb02..2c79cb31 100644 --- a/routes/users.js +++ b/routes/users.js @@ -154,15 +154,20 @@ return global.css; }) }, function(err, html) { - var email, sendgrid; - sendgrid = require('sendgrid')(config.sendgrid_user, config.sendgrid_password); - email = new sendgrid.Email({ - to: req.body.email, - from: '[email protected]', - subject: 'Welcome to CoinOS', - html: html + var content, from_email, helper, mail, sg, subject, to_email; + helper = require('sendgrid').mail; + from_email = new helper.Email('[email protected]'); + to_email = new helper.Email(req.body.email); + subject = 'Welcome to CoinOS'; + content = new helper.Content('text/html', html); + mail = new helper.Mail(from_email, subject, to_email, content); + sg = require('sendgrid')(config.sendgrid_token); + request = sg.emptyRequest({ + method: 'POST', + path: '/v3/mail/send', + body: mail.toJSON() }); - return sendgrid.send(email); + return sg.API(request); }); }); }); @@ -232,15 +237,20 @@ return global.css; }) }, function(err, html) { - var email, sendgrid; - sendgrid = require('sendgrid')(config.sendgrid_user, config.sendgrid_password); - email = new sendgrid.Email({ - to: req.body.email, - from: '[email protected]', - subject: 'CoinOS Wallet Key', - html: html + var content, from_email, helper, mail, sg, subject, to_email; + helper = require('sendgrid').mail; + from_email = new helper.Email('[email protected]'); + to_email = new helper.Email(req.body.email); + subject = 'CoinOS Wallet Key'; + content = new helper.Content('text/html', html); + mail = new helper.Mail(from_email, subject, to_email, content); + sg = require('sendgrid')(config.sendgrid_token); + request = sg.emptyRequest({ + method: 'POST', + path: '/v3/mail/send', + body: mail.toJSON() }); - return sendgrid.send(email); + return sg.API(request); }); } }, |
