mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Adding No Auth support to social email out node (#277)
* Let email out node connect to SMTP without authentication Add the possibility to connect to local SMTP without authentication. * Adapt test to connect to SMTP without credentials Adapt test to connect to SMTP without credentials * Add coverage for social email out node Add coverage for social email out node * Add more coverage to email out node Add more coverage to email out node
This commit is contained in:
committed by
Dave Conway-Jones
parent
367237d946
commit
8e001fcd45
@@ -37,8 +37,6 @@ module.exports = function(RED) {
|
||||
if (globalkeys) {
|
||||
this.userid = globalkeys.user;
|
||||
flag = true;
|
||||
} else {
|
||||
this.error(RED._("email.errors.nouserid"));
|
||||
}
|
||||
}
|
||||
if (this.credentials && this.credentials.hasOwnProperty("password")) {
|
||||
@@ -47,8 +45,6 @@ module.exports = function(RED) {
|
||||
if (globalkeys) {
|
||||
this.password = globalkeys.pass;
|
||||
flag = true;
|
||||
} else {
|
||||
this.error(RED._("email.errors.nopassword"));
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
@@ -59,12 +55,15 @@ module.exports = function(RED) {
|
||||
var smtpTransport = nodemailer.createTransport({
|
||||
host: node.outserver,
|
||||
port: node.outport,
|
||||
secure: node.secure,
|
||||
auth: {
|
||||
secure: node.secure
|
||||
});
|
||||
|
||||
if(this.userid && this.password) {
|
||||
smtpTransport.auth = {
|
||||
user: node.userid,
|
||||
pass: node.password
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
this.on("input", function(msg) {
|
||||
if (msg.hasOwnProperty("payload")) {
|
||||
@@ -113,7 +112,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
});
|
||||
}
|
||||
else { node.warn(RED._("email.errors.nocredentials")); }
|
||||
else { node.warn(RED._("email.errors.nosmtptransport")); }
|
||||
}
|
||||
else { node.warn(RED._("email.errors.nopayload")); }
|
||||
});
|
||||
|
Reference in New Issue
Block a user