@5minds/node-red-contrib-processcube-tools 1.0.2 → 1.0.3-develop-1fbfd8-mfqjapky
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.
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
</div>
|
|
207
207
|
<div class="form-row">
|
|
208
208
|
<label for="node-input-password"><i class="fa fa-lock"></i> Password</label>
|
|
209
|
-
<input type="
|
|
209
|
+
<input type="text" id="node-input-password" />
|
|
210
210
|
<input type="hidden" id="node-input-passwordType" />
|
|
211
211
|
</div>
|
|
212
212
|
<div class="form-row">
|
|
@@ -222,85 +222,111 @@
|
|
|
222
222
|
</script>
|
|
223
223
|
|
|
224
224
|
<script type="text/html" data-help-name="email-sender">
|
|
225
|
+
<p>A custom Node-RED node that simplifies sending emails using an SMTP server.</p>
|
|
226
|
+
|
|
227
|
+
<h3>Description</h3>
|
|
228
|
+
<p>
|
|
229
|
+
The <b>email-sender</b> node is designed to send emails from your Node-RED flows. It supports a wide range of
|
|
230
|
+
features, including sending HTML content, adding attachments, and using flexible configurations for all email
|
|
231
|
+
and SMTP settings. All fields are <b>typed inputs</b>, meaning you can pull values from different sources like
|
|
232
|
+
<code>msg</code> properties, <code>flow</code>/<code>global</code> context, or environment variables.
|
|
233
|
+
</p>
|
|
234
|
+
|
|
235
|
+
<h3>Inputs</h3>
|
|
225
236
|
<p>
|
|
226
|
-
|
|
227
|
-
|
|
237
|
+
This node accepts a message (<code>msg</code>) as input. The node is triggered when it receives a message. The
|
|
238
|
+
properties of the incoming message can be used to set the email's configuration fields.
|
|
228
239
|
</p>
|
|
229
240
|
|
|
241
|
+
<h3>Outputs</h3>
|
|
242
|
+
<p>This node sends one message upon successful execution.</p>
|
|
243
|
+
<dl class="message-properties">
|
|
244
|
+
<dt>payload <span class="property-type">any</span></dt>
|
|
245
|
+
<dd>The <code>payload</code> of the original message is passed through to the next node.</dd>
|
|
246
|
+
<dt>topic <span class="property-type">string</span></dt>
|
|
247
|
+
<dd>The <code>topic</code> of the original message is passed through to the next node.</dd>
|
|
248
|
+
</dl>
|
|
249
|
+
<p>The node's status will be updated to show whether the email was sent successfully.</p>
|
|
250
|
+
|
|
230
251
|
<h3>Configuration</h3>
|
|
231
252
|
<p>
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
<b>HTML Content</b> are required fields and must be configured before the node can be deployed.
|
|
253
|
+
All configuration fields are <b>typed inputs</b>, allowing you to set a <b>static value</b> or pull data
|
|
254
|
+
dynamically from a <b>message</b>, <b>flow</b>, <b>global</b> context, or <b>environment variable</b>.
|
|
235
255
|
</p>
|
|
236
256
|
|
|
237
257
|
<h4>Mail Configuration</h4>
|
|
238
258
|
<dl class="message-properties">
|
|
259
|
+
<dt>Name <i>(Optional)</i> <span class="property-type">string</span></dt>
|
|
260
|
+
<dd>A descriptive name for the node.</dd>
|
|
239
261
|
<dt>Sender <span class="property-type">string | variable</span></dt>
|
|
240
|
-
<dd>The name
|
|
241
|
-
|
|
262
|
+
<dd>The name displayed as the sender to the recipient.</dd>
|
|
242
263
|
<dt>Address <span class="property-type">string | variable</span></dt>
|
|
243
|
-
<dd>The
|
|
244
|
-
|
|
264
|
+
<dd>The email address from which the email is sent.</dd>
|
|
245
265
|
<dt>To <span class="property-type">string | variable</span></dt>
|
|
246
|
-
<dd>The primary recipient
|
|
247
|
-
|
|
248
|
-
<
|
|
249
|
-
<
|
|
250
|
-
|
|
251
|
-
<dt>
|
|
252
|
-
<dd>
|
|
253
|
-
|
|
254
|
-
<dt>Reply To <span class="property-type">string | variable</span></dt>
|
|
255
|
-
<dd>Address that is being set as the that will be set, if the user presses the reply button.
|
|
256
|
-
Can be different than the email, that has sent the email.</dd>
|
|
257
|
-
|
|
266
|
+
<dd>The primary recipient(s) of the email. For multiple recipients, separate addresses with a comma.</dd>
|
|
267
|
+
<dt>CC <i>(Optional)</i> <span class="property-type">string | variable</span></dt>
|
|
268
|
+
<dd>Carbon copy recipient(s). Multiple addresses should be separated by commas.</dd>
|
|
269
|
+
<dt>BCC <i>(Optional)</i> <span class="property-type">string | variable</span></dt>
|
|
270
|
+
<dd>Blind carbon copy recipient(s). Multiple addresses should be separated by commas.</dd>
|
|
271
|
+
<dt>Reply To <i>(Optional)</i> <span class="property-type">string | variable</span></dt>
|
|
272
|
+
<dd>The email address that is pre-filled when the recipient replies to the email.</dd>
|
|
258
273
|
<dt>Subject <span class="property-type">string | variable</span></dt>
|
|
259
274
|
<dd>The subject line of the email.</dd>
|
|
260
|
-
|
|
261
275
|
<dt>HTML Content <span class="property-type">string | variable</span></dt>
|
|
262
|
-
<dd>The HTML body of the email.</dd>
|
|
263
|
-
|
|
264
|
-
<
|
|
265
|
-
|
|
276
|
+
<dd>The full HTML body of the email.</dd>
|
|
277
|
+
<dt>Attachments <i>(Optional)</i> <span class="property-type">array | variable</span></dt>
|
|
278
|
+
<dd>
|
|
279
|
+
A list of file attachments. This field should be an array of attachment objects. Each object must contain
|
|
280
|
+
<code>filename</code>, <code>content</code> (the file's data), and optionally <code>contentType</code>.
|
|
281
|
+
</dd>
|
|
266
282
|
</dl>
|
|
267
283
|
|
|
268
284
|
<h4>SMTP Configuration</h4>
|
|
269
285
|
<dl class="message-properties">
|
|
270
286
|
<dt>Host <span class="property-type">string | variable</span></dt>
|
|
271
|
-
<dd>The hostname
|
|
272
|
-
|
|
287
|
+
<dd>The hostname of your SMTP server (e.g., <code>smtp.gmail.com</code>).</dd>
|
|
273
288
|
<dt>Port <span class="property-type">number | variable</span></dt>
|
|
274
|
-
<dd>The port number
|
|
275
|
-
|
|
289
|
+
<dd>The port number for the SMTP server (e.g., <code>587</code> or <code>465</code>).</dd>
|
|
276
290
|
<dt>User <span class="property-type">string | variable</span></dt>
|
|
277
291
|
<dd>The username for SMTP authentication.</dd>
|
|
278
|
-
|
|
279
|
-
<dt>Password <span class="property-type">string | variable</span></dt>
|
|
280
|
-
<dd>The password for SMTP authentication.</dd>
|
|
281
|
-
|
|
282
|
-
<dt>SSL/TLS (Secure) <span class="property-type">boolean | variable</span></dt>
|
|
292
|
+
<dt>Password <span class="property-type">password | variable</span></dt>
|
|
283
293
|
<dd>
|
|
284
|
-
|
|
285
|
-
|
|
294
|
+
The password for SMTP authentication. This is a secure field and its value will not be shown after
|
|
295
|
+
deployment.
|
|
286
296
|
</dd>
|
|
287
|
-
|
|
297
|
+
<dt>SSL/TLS (Secure) <span class="property-type">boolean | variable</span></dt>
|
|
298
|
+
<dd>Enables a secure connection. Set this to <code>true</code> to use SSL/TLS encryption.</dd>
|
|
288
299
|
<dt>Reject Unauthorized <span class="property-type">boolean | variable</span></dt>
|
|
289
|
-
<dd>
|
|
300
|
+
<dd>
|
|
301
|
+
If <code>true</code>, the server's certificate is rejected if it isn't authorized by a trusted Certificate
|
|
302
|
+
Authority (CA). Set this to <code>false</code> only if you know the server's certificate is self-signed or
|
|
303
|
+
not from a trusted CA.
|
|
304
|
+
</dd>
|
|
290
305
|
</dl>
|
|
291
306
|
|
|
292
|
-
<h3>Usage</h3>
|
|
293
|
-
<
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
307
|
+
<h3>Usage Notes</h3>
|
|
308
|
+
<ul>
|
|
309
|
+
<li>
|
|
310
|
+
<b>Dynamic Content</b>: You can use a <b>Template node</b> before the <b>email-sender</b> node to generate
|
|
311
|
+
dynamic HTML content for your emails, using <code>msg</code> properties to fill in placeholders.
|
|
312
|
+
</li>
|
|
313
|
+
<li>
|
|
314
|
+
<b>Testing</b>: When testing, use a free service like
|
|
315
|
+
<a href="https://mailtrap.io" target="_blank">Mailtrap</a> to avoid sending real emails. This allows you to
|
|
316
|
+
inspect the email and its content without cluttering your inbox.
|
|
317
|
+
</li>
|
|
318
|
+
<li>
|
|
319
|
+
<b>Troubleshooting</b>: If you encounter a <code>Missing required IMAP config</code> error, double-check
|
|
320
|
+
that all required fields are correctly configured and have values.
|
|
321
|
+
</li>
|
|
322
|
+
</ul>
|
|
299
323
|
|
|
300
|
-
<h3>
|
|
324
|
+
<h3>Example</h3>
|
|
325
|
+
<p>A basic flow could look like this:</p>
|
|
326
|
+
<code>Inject Node</code> ➡️ <code>Change Node</code> ➡️ <code>email-sender Node</code>
|
|
301
327
|
<p>
|
|
302
|
-
<b>
|
|
303
|
-
|
|
304
|
-
|
|
328
|
+
In the <b>Change Node</b>, you can set <code>msg.payload</code> to your email's content and
|
|
329
|
+
<code>msg.topic</code> to the subject. The <b>email-sender</b> node can then be configured to use these message
|
|
330
|
+
properties as its input.
|
|
305
331
|
</p>
|
|
306
332
|
</script>
|
|
@@ -48,7 +48,7 @@ module.exports = function (RED) {
|
|
|
48
48
|
// Handle attachments and format them for Nodemailer
|
|
49
49
|
let processedAttachments = [];
|
|
50
50
|
|
|
51
|
-
let parsedAttachments =
|
|
51
|
+
let parsedAttachments = attachments;
|
|
52
52
|
|
|
53
53
|
if (config.attachmentsType === 'json' && typeof parsedAttachments === 'string') {
|
|
54
54
|
try {
|
|
@@ -157,8 +157,6 @@ module.exports = function (RED) {
|
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
RED.nodes.registerType('email-sender', EmailSenderNode);
|
|
161
|
-
|
|
162
160
|
function safeEvaluatePropertyAttachment(config, node, msg) {
|
|
163
161
|
if (config.attachments && config.attachments.trim() !== '') {
|
|
164
162
|
try {
|
|
@@ -171,4 +169,10 @@ module.exports = function (RED) {
|
|
|
171
169
|
|
|
172
170
|
return null;
|
|
173
171
|
}
|
|
172
|
+
|
|
173
|
+
RED.nodes.registerType('email-sender', EmailSenderNode, {
|
|
174
|
+
credentials: {
|
|
175
|
+
password: { type: 'password' },
|
|
176
|
+
},
|
|
177
|
+
});
|
|
174
178
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@5minds/node-red-contrib-processcube-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3-develop-1fbfd8-mfqjapky",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Node-RED tools nodes for ProcessCube",
|
|
6
6
|
"scripts": {
|
|
@@ -57,7 +57,12 @@
|
|
|
57
57
|
},
|
|
58
58
|
"overrides": {
|
|
59
59
|
"semver": ">=7.5.2",
|
|
60
|
-
"axios": ">=1.12.0"
|
|
60
|
+
"axios": ">=1.12.0",
|
|
61
|
+
"html-to-text": "^9.0.5",
|
|
62
|
+
"mailparser": "^3.6.8",
|
|
63
|
+
"node-imap": "^0.9.6",
|
|
64
|
+
"nodemailer": "^7.0.6",
|
|
65
|
+
"utf7": "^1.0.2"
|
|
61
66
|
},
|
|
62
67
|
"keywords": [
|
|
63
68
|
"node-red",
|