From 45e4c6d9d44b4e62b4be6b3e04728ebe306579f2 Mon Sep 17 00:00:00 2001
From: Schreck1985 <41887216+Schreck1985@users.noreply.github.com>
Date: Wed, 22 Aug 2018 14:57:42 +0200
Subject: [PATCH] Node red mail usetls (#480)
* Default value for tls, checking if tls is set to false
---
social/email/61-email.html | 6 ++++++
social/email/61-email.js | 7 ++++++-
social/email/locales/en-US/61-email.json | 1 +
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/social/email/61-email.html b/social/email/61-email.html
index 0d684a43..52e4c38d 100644
--- a/social/email/61-email.html
+++ b/social/email/61-email.html
@@ -49,6 +49,10 @@
+
Alternatively you may provide msg.attachments
which should contain an array of one or
more attachments in nodemailer format.
If required by your recipient you may also pass in a msg.envelope
object, typically containing extra from and to properties.
If you have own signed certificates, Nodemailer can complain about that and refuse sending the message. In this case you can try switching off TLS.
Note: uses SMTP with SSL to port 465.
@@ -81,6 +86,7 @@ server: {value:"smtp.gmail.com",required:true}, port: {value:"465",required:true}, secure: {value: true}, + tls: {value: true}, name: {value:""}, dname: {value:""} }, diff --git a/social/email/61-email.js b/social/email/61-email.js index 92a7cdea..e3e6a0fa 100644 --- a/social/email/61-email.js +++ b/social/email/61-email.js @@ -30,6 +30,7 @@ module.exports = function(RED) { this.outserver = n.server; this.outport = n.port; this.secure = n.secure; + this.tls = true; var flag = false; if (this.credentials && this.credentials.hasOwnProperty("userid")) { this.userid = this.credentials.userid; @@ -50,12 +51,16 @@ module.exports = function(RED) { if (flag) { RED.nodes.addCredentials(n.id,{userid:this.userid, password:this.password, global:true}); } + if (n.tls === false){ + this.tls = false; + } var node = this; var smtpOptions = { host: node.outserver, port: node.outport, - secure: node.secure + secure: node.secure, + tls: {rejectUnauthorized: node.tls} } if (this.userid && this.password) { diff --git a/social/email/locales/en-US/61-email.json b/social/email/locales/en-US/61-email.json index fbe47766..d3f05375 100644 --- a/social/email/locales/en-US/61-email.json +++ b/social/email/locales/en-US/61-email.json @@ -13,6 +13,7 @@ "folder": "Folder", "protocol": "Protocol", "useSSL": "Use SSL?", + "useTLS": "Use TLS?", "disposition": "Disposition", "none": "None", "read": "Mark Read",