From f15f8598f3f52c8e470c47bcd1c672f6e3dd3533 Mon Sep 17 00:00:00 2001 From: timolehto Date: Tue, 21 Feb 2017 15:00:21 +0200 Subject: [PATCH] Fixes smtp/auth bug: https://github.com/node-red/node-red-nodes/issues/279 (#280) --- social/email/61-email.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/social/email/61-email.js b/social/email/61-email.js index 9a7c0c34..c6172f2a 100644 --- a/social/email/61-email.js +++ b/social/email/61-email.js @@ -52,22 +52,19 @@ module.exports = function(RED) { } var node = this; - var smtpTransport = nodemailer.createTransport({ + var smtpOptions = { host: node.outserver, port: node.outport, - secure: node.secure, - auth: { - user: node.userid, - pass: node.password - } - }); + secure: node.secure + } if(this.userid && this.password) { - smtpTransport.auth = { + smtpOptions.auth = { user: node.userid, pass: node.password }; } + var smtpTransport = nodemailer.createTransport(smtpOptions); this.on("input", function(msg) { if (msg.hasOwnProperty("payload")) {