Upgrade Nodemailer to 1.0

This commit is contained in:
Sahat Yalkabov
2014-07-15 17:21:09 -04:00
parent c3d46120f2
commit 5d5a882df8

View File

@ -274,7 +274,7 @@ exports.postReset = function(req, res, next) {
}); });
}, },
function(user, done) { function(user, done) {
var smtpTransport = nodemailer.createTransport('SMTP', { var transporter = nodemailer.createTransport({
service: 'SendGrid', service: 'SendGrid',
auth: { auth: {
user: secrets.sendgrid.user, user: secrets.sendgrid.user,
@ -288,7 +288,7 @@ exports.postReset = function(req, res, next) {
text: 'Hello,\n\n' + text: 'Hello,\n\n' +
'This is a confirmation that the password for your account ' + user.email + ' has just been changed.\n' 'This is a confirmation that the password for your account ' + user.email + ' has just been changed.\n'
}; };
smtpTransport.sendMail(mailOptions, function(err) { transporter.sendMail(mailOptions, function(err) {
req.flash('success', { msg: 'Success! Your password has been changed.' }); req.flash('success', { msg: 'Success! Your password has been changed.' });
done(err); done(err);
}); });
@ -352,7 +352,7 @@ exports.postForgot = function(req, res, next) {
}); });
}, },
function(token, user, done) { function(token, user, done) {
var smtpTransport = nodemailer.createTransport('SMTP', { var transporter = nodemailer.createTransport({
service: 'SendGrid', service: 'SendGrid',
auth: { auth: {
user: secrets.sendgrid.user, user: secrets.sendgrid.user,
@ -368,7 +368,7 @@ exports.postForgot = function(req, res, next) {
'http://' + req.headers.host + '/reset/' + token + '\n\n' + 'http://' + req.headers.host + '/reset/' + token + '\n\n' +
'If you did not request this, please ignore this email and your password will remain unchanged.\n' 'If you did not request this, please ignore this email and your password will remain unchanged.\n'
}; };
smtpTransport.sendMail(mailOptions, function(err) { transporter.sendMail(mailOptions, function(err) {
req.flash('info', { msg: 'An e-mail has been sent to ' + user.email + ' with further instructions.' }); req.flash('info', { msg: 'An e-mail has been sent to ' + user.email + ' with further instructions.' });
done(err, 'done'); done(err, 'done');
}); });