From 3e75c6f6a3940cde6c85412897a6bcb6ddd9def4 Mon Sep 17 00:00:00 2001 From: Terry Tate Date: Sun, 21 Feb 2016 17:13:44 +0000 Subject: [PATCH] Update to nodemailer 2.0 syntax for smtpTransport Fixes #4193 --- package.json | 1 + src/emailer.js | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index d7078648f8..9c318d280e 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "nodebb-widget-essentials": "2.0.6", "nodemailer": "2.0.0", "nodemailer-sendmail-transport": "1.0.0", + "nodemailer-smtp-transport": "1.0.0", "passport": "^0.3.0", "passport-local": "1.0.0", "postcss": "^5.0.13", diff --git a/src/emailer.js b/src/emailer.js index ce8e182653..522330f70b 100644 --- a/src/emailer.js +++ b/src/emailer.js @@ -1,11 +1,12 @@ "use strict"; -var async = require('async'); +var async = require('async'); var winston = require('winston'); var nconf = require('nconf'); var templates = require('templates.js'); var nodemailer = require('nodemailer'); var sendmailTransport = require('nodemailer-sendmail-transport'); +var smtpTransport = require('nodemailer-smtp-transport'); var htmlToText = require('html-to-text'); var url = require('url'); @@ -28,13 +29,15 @@ var fallbackTransport; // Enable Gmail transport if enabled in ACP if (parseInt(meta.config['email:GmailTransport:enabled'], 10) === 1) { - fallbackTransport = transports.gmail = nodemailer.createTransport('SMTP', { - service: 'Gmail', + fallbackTransport = transports.gmail = nodemailer.createTransport(smtpTransport({ + host: 'smtp.gmail.com', + port: 465, + secure: true, auth: { user: meta.config['email:GmailTransport:user'], pass: meta.config['email:GmailTransport:pass'] } - }); + })); } else { fallbackTransport = transports.sendmail; }