@5minds/node-red-contrib-processcube-tools 1.0.1-feature-122227-mfgey2et → 1.0.1-feature-24a79f-mfgha47l
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
outputs: 1,
|
|
41
41
|
icon: "font-awesome/fa-paper-plane",
|
|
42
42
|
label: function() {
|
|
43
|
-
return this.name || "
|
|
43
|
+
return this.name || "E-Mail Sender";
|
|
44
44
|
},
|
|
45
45
|
oneditprepare: function() {
|
|
46
46
|
// Mail Fields
|
|
@@ -232,7 +232,6 @@
|
|
|
232
232
|
|
|
233
233
|
<dt>Attachments <span class="property-type">array | variable</span></dt>
|
|
234
234
|
<dd>A list of file attachments. This should be a variable containing an array of attachment objects.</dd>
|
|
235
|
-
|
|
236
235
|
</dl>
|
|
237
236
|
|
|
238
237
|
<h4>SMTP Configuration</h4>
|
|
@@ -255,4 +254,13 @@
|
|
|
255
254
|
<dt>Reject Unauthorized <span class="property-type">boolean | variable</span></dt>
|
|
256
255
|
<dd>If <code>true</code>, the server's certificate is rejected if it's not authorized by a trusted CA.</dd>
|
|
257
256
|
</dl>
|
|
257
|
+
|
|
258
|
+
<h3>Usage</h3>
|
|
259
|
+
<p>Inject a message to trigger the node and send an email.<br>
|
|
260
|
+
Credentials and other properties can be provided via message properties, flow/global context, or environment variables.<br>
|
|
261
|
+
The node supports sending HTML emails and attachments.</p>
|
|
262
|
+
|
|
263
|
+
<h3>Tips</h3>
|
|
264
|
+
<p><b>HTML Content Creation:</b><br>
|
|
265
|
+
To generate or format HTML content for your email, you can use a <b>template node</b> before the email-sender node. This allows you to create dynamic and customized email bodies.</p>
|
|
258
266
|
</script>
|
|
@@ -18,7 +18,7 @@ module.exports = function(RED) {
|
|
|
18
18
|
const bcc = RED.util.evaluateNodeProperty(config.bcc, config.bccType, node, msg) || "";
|
|
19
19
|
const subject = RED.util.evaluateNodeProperty(config.subject, config.subjectType, node, msg) || msg.topic || "Message from Node-RED";
|
|
20
20
|
const htmlContent = RED.util.evaluateNodeProperty(config.htmlContent, config.htmlContentType, node, msg);
|
|
21
|
-
const attachments =
|
|
21
|
+
const attachments = safeEvaluatePropertyAttachment(config, node, msg);
|
|
22
22
|
|
|
23
23
|
// Retrieve and evaluate SMTP configuration values
|
|
24
24
|
const host = RED.util.evaluateNodeProperty(config.host, config.hostType, node, msg);
|
|
@@ -83,7 +83,20 @@ module.exports = function(RED) {
|
|
|
83
83
|
transporter.sendMail(mailOptions, (error, info) => {
|
|
84
84
|
if (error) {
|
|
85
85
|
node.status({ fill: "red", shape: "dot", text: "error sending" });
|
|
86
|
-
|
|
86
|
+
if (
|
|
87
|
+
error.message &&
|
|
88
|
+
error.message.includes("SSL routines") &&
|
|
89
|
+
error.message.includes("wrong version number")
|
|
90
|
+
) {
|
|
91
|
+
// Improved error message for SSL/TLS issues
|
|
92
|
+
done(new Error(
|
|
93
|
+
"SSL/TLS connection failed: Wrong version number. " +
|
|
94
|
+
"This usually means the wrong port or security settings are used. " +
|
|
95
|
+
"For SMTP: use port 587 with secure=false (STARTTLS) or port 465 with secure=true (SSL/TLS)."
|
|
96
|
+
));
|
|
97
|
+
} else {
|
|
98
|
+
done(error);
|
|
99
|
+
}
|
|
87
100
|
} else {
|
|
88
101
|
node.log('Email sent: ' + info.response);
|
|
89
102
|
msg.payload = info;
|
|
@@ -111,4 +124,17 @@ module.exports = function(RED) {
|
|
|
111
124
|
}
|
|
112
125
|
|
|
113
126
|
RED.nodes.registerType("email-sender", EmailSenderNode);
|
|
127
|
+
|
|
128
|
+
function safeEvaluatePropertyAttachment(config, node, msg) {
|
|
129
|
+
if (config.attachments && config.attachments.trim() !== '') {
|
|
130
|
+
try {
|
|
131
|
+
return RED.util.evaluateNodeProperty(config.attachments, config.attachmentsType, node, msg);
|
|
132
|
+
} catch (e) {
|
|
133
|
+
node.error("Failed to evaluate attachments property: " + e.message, msg);
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
114
140
|
};
|
package/package.json
CHANGED