@5minds/node-red-contrib-processcube-tools 1.0.1-feature-9a380c-mfm58gob → 1.0.1-feature-709a7c-mfnlsw5g

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.
@@ -19,6 +19,8 @@
19
19
  ccType: { value: 'str' },
20
20
  bcc: { value: '', validate: RED.validators.typedInput('bccType') },
21
21
  bccType: { value: 'str' },
22
+ replyTo: { value: '', validate: RED.validators.typedInput('replyToType') },
23
+ replyToType: { value: 'str' },
22
24
  subject: { value: '', required: true, validate: RED.validators.typedInput('subjectType') },
23
25
  subjectType: { value: 'str' },
24
26
  htmlContent: { value: '', required: true, validate: RED.validators.typedInput('htmlContentType') },
@@ -77,6 +79,11 @@
77
79
  types: ['str', 'msg', 'flow', 'global', 'env'],
78
80
  typeField: '#node-input-bccType',
79
81
  });
82
+ $('#node-input-replyTo').typedInput({
83
+ default: 'str',
84
+ types: ['str', 'msg', 'flow', 'global', 'env'],
85
+ typeField: '#node-input-replyToType',
86
+ });
80
87
  $('#node-input-subject').typedInput({
81
88
  default: 'str',
82
89
  types: ['str', 'msg', 'flow', 'global', 'env'],
@@ -160,6 +167,11 @@
160
167
  <input type="text" id="node-input-bcc" />
161
168
  <input type="hidden" id="node-input-bccType" />
162
169
  </div>
170
+ <div class="form-row">
171
+ <label for="node-input-replyTo"><i class="fa fa-mail-reply"></i> Reply To</label>
172
+ <input type="text" id="node-input-replyTo" />
173
+ <input type="hidden" id="node-input-replyToType" />
174
+ </div>
163
175
  <div class="form-row">
164
176
  <label for="node-input-subject"><i class="fa fa-info-circle"></i> Subject</label>
165
177
  <input type="text" id="node-input-subject" />
@@ -194,7 +206,7 @@
194
206
  </div>
195
207
  <div class="form-row">
196
208
  <label for="node-input-password"><i class="fa fa-lock"></i> Password</label>
197
- <input type="password" id="node-input-password" />
209
+ <input type="text" id="node-input-password" />
198
210
  <input type="hidden" id="node-input-passwordType" />
199
211
  </div>
200
212
  <div class="form-row">
@@ -211,80 +223,85 @@
211
223
 
212
224
  <script type="text/html" data-help-name="email-sender">
213
225
  <p>
214
- A custom node to send emails using an SMTP server. The configuration for each field can be sourced from a fixed
215
- value, or from a <code>msg</code>, <code>flow</code>, <code>global</code>, or <code>env</code> variable.
226
+ A custom Node-RED node that simplifies sending emails using an SMTP server.
227
+ </p>
228
+
229
+ <h3>Description</h3>
230
+ <p>
231
+ The <b>email-sender</b> node is designed to send emails from your Node-RED flows. It supports a wide range of features, including sending HTML content, adding attachments, and using flexible configurations for all email and SMTP settings. All fields are <b>typed inputs</b>, meaning you can pull values from different sources like <code>msg</code> properties, <code>flow</code>/<code>global</code> context, or environment variables.
216
232
  </p>
217
233
 
234
+ <h3>Inputs</h3>
235
+ <p>
236
+ This node accepts a message (<code>msg</code>) as input. The node is triggered when it receives a message. The properties of the incoming message can be used to set the email's configuration fields.
237
+ </p>
238
+
239
+ <h3>Outputs</h3>
240
+ <p>
241
+ This node sends one message upon successful execution.
242
+ </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
+
218
251
  <h3>Configuration</h3>
219
252
  <p>
220
- Every field on the configuration panel is a <b>typed input</b>. Use the dropdown menu next to each field to
221
- select the source of its value. Note that <b>Sender</b>, <b>Address</b>, <b>To</b>, <b>Subject</b>, and
222
- <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 dynamically from a <b>message</b>, <b>flow</b>, <b>global</b> context, or <b>environment variable</b>.
223
254
  </p>
224
255
 
225
256
  <h4>Mail Configuration</h4>
226
257
  <dl class="message-properties">
258
+ <dt>Name <i>(Optional)</i> <span class="property-type">string</span></dt>
259
+ <dd>A descriptive name for the node.</dd>
227
260
  <dt>Sender <span class="property-type">string | variable</span></dt>
228
- <dd>The name of the sender, as displayed to the recipient.</dd>
229
-
261
+ <dd>The name displayed as the sender to the recipient.</dd>
230
262
  <dt>Address <span class="property-type">string | variable</span></dt>
231
- <dd>The sender's email address.</dd>
232
-
263
+ <dd>The email address from which the email is sent.</dd>
233
264
  <dt>To <span class="property-type">string | variable</span></dt>
234
- <dd>The primary recipient's email address. Separate multiple addresses with a comma.</dd>
235
-
236
- <dt>CC <span class="property-type">string | variable</span></dt>
237
- <dd>Addresses to be carbon-copied on the email.</dd>
238
-
239
- <dt>BCC <span class="property-type">string | variable</span></dt>
240
- <dd>Addresses to be blind-carbon-copied on the email.</dd>
241
-
265
+ <dd>The primary recipient(s) of the email. For multiple recipients, separate addresses with a comma.</dd>
266
+ <dt>CC <i>(Optional)</i> <span class="property-type">string | variable</span></dt>
267
+ <dd>Carbon copy recipient(s). Multiple addresses should be separated by commas.</dd>
268
+ <dt>BCC <i>(Optional)</i> <span class="property-type">string | variable</span></dt>
269
+ <dd>Blind carbon copy recipient(s). Multiple addresses should be separated by commas.</dd>
270
+ <dt>Reply To <i>(Optional)</i> <span class="property-type">string | variable</span></dt>
271
+ <dd>The email address that is pre-filled when the recipient replies to the email.</dd>
242
272
  <dt>Subject <span class="property-type">string | variable</span></dt>
243
273
  <dd>The subject line of the email.</dd>
244
-
245
274
  <dt>HTML Content <span class="property-type">string | variable</span></dt>
246
- <dd>The HTML body of the email.</dd>
247
-
248
- <dt>Attachments <span class="property-type">array | variable</span></dt>
249
- <dd>A list of file attachments. This should be a variable containing an array of attachment objects.</dd>
275
+ <dd>The full HTML body of the email.</dd>
276
+ <dt>Attachments <i>(Optional)</i> <span class="property-type">array | variable</span></dt>
277
+ <dd>A list of file attachments. This field should be an array of attachment objects. Each object must contain <code>filename</code>, <code>content</code> (the file's data), and optionally <code>contentType</code>.</dd>
250
278
  </dl>
251
279
 
252
280
  <h4>SMTP Configuration</h4>
253
281
  <dl class="message-properties">
254
282
  <dt>Host <span class="property-type">string | variable</span></dt>
255
- <dd>The hostname or IP address of the SMTP server.</dd>
256
-
283
+ <dd>The hostname of your SMTP server (e.g., <code>smtp.gmail.com</code>).</dd>
257
284
  <dt>Port <span class="property-type">number | variable</span></dt>
258
- <dd>The port number of the SMTP server.</dd>
259
-
285
+ <dd>The port number for the SMTP server (e.g., <code>587</code> or <code>465</code>).</dd>
260
286
  <dt>User <span class="property-type">string | variable</span></dt>
261
287
  <dd>The username for SMTP authentication.</dd>
262
-
263
- <dt>Password <span class="property-type">string | variable</span></dt>
264
- <dd>The password for SMTP authentication.</dd>
265
-
288
+ <dt>Password <span class="property-type">password | variable</span></dt>
289
+ <dd>The password for SMTP authentication. This is a secure field and its value will not be shown after deployment.</dd>
266
290
  <dt>SSL/TLS (Secure) <span class="property-type">boolean | variable</span></dt>
267
- <dd>
268
- Use a secure connection. Set to <code>true</code> for SSL/TLS, <code>false</code> for a non-secure
269
- connection.
270
- </dd>
271
-
291
+ <dd>Enables a secure connection. Set this to <code>true</code> to use SSL/TLS encryption.</dd>
272
292
  <dt>Reject Unauthorized <span class="property-type">boolean | variable</span></dt>
273
- <dd>If <code>true</code>, the server's certificate is rejected if it's not authorized by a trusted CA.</dd>
293
+ <dd>If <code>true</code>, the server's certificate is rejected if it isn't authorized by a trusted Certificate Authority (CA). Set this to <code>false</code> only if you know the server's certificate is self-signed or not from a trusted CA.</dd>
274
294
  </dl>
275
295
 
276
- <h3>Usage</h3>
277
- <p>
278
- Inject a message to trigger the node and send an email.<br />
279
- Credentials and other properties can be provided via message properties, flow/global context, or environment
280
- variables.<br />
281
- The node supports sending HTML emails and attachments.
282
- </p>
296
+ <h3>Usage Notes</h3>
297
+ <ul>
298
+ <li><b>Dynamic Content</b>: You can use a <b>Template node</b> before the <b>email-sender</b> node to generate dynamic HTML content for your emails, using <code>msg</code> properties to fill in placeholders.</li>
299
+ <li><b>Testing</b>: When testing, use a free service like <a href="https://mailtrap.io" target="_blank">Mailtrap</a> to avoid sending real emails. This allows you to inspect the email and its content without cluttering your inbox.</li>
300
+ <li><b>Troubleshooting</b>: If you encounter a <code>Missing required IMAP config</code> error, double-check that all required fields are correctly configured and have values.</li>
301
+ </ul>
283
302
 
284
- <h3>Tips</h3>
285
- <p>
286
- <b>HTML Content Creation:</b><br />
287
- To generate or format HTML content for your email, you can use a <b>template node</b> before the email-sender
288
- node. This allows you to create dynamic and customized email bodies.
289
- </p>
303
+ <h3>Example</h3>
304
+ <p>A basic flow could look like this:</p>
305
+ <code>Inject Node</code> ➡️ <code>Change Node</code> ➡️ <code>email-sender Node</code>
306
+ <p>In the <b>Change Node</b>, you can set <code>msg.payload</code> to your email's content and <code>msg.topic</code> to the subject. The <b>email-sender</b> node can then be configured to use these message properties as its input.</p>
290
307
  </script>
@@ -24,6 +24,7 @@ module.exports = function (RED) {
24
24
  const to = RED.util.evaluateNodeProperty(config.to, config.toType, node, msg);
25
25
  const cc = RED.util.evaluateNodeProperty(config.cc, config.ccType, node, msg) || '';
26
26
  const bcc = RED.util.evaluateNodeProperty(config.bcc, config.bccType, node, msg) || '';
27
+ const replyTo = RED.util.evaluateNodeProperty(config.replyTo, config.replyToType, node, msg) || '';
27
28
  const subject =
28
29
  RED.util.evaluateNodeProperty(config.subject, config.subjectType, node, msg) ||
29
30
  msg.topic ||
@@ -104,6 +105,7 @@ module.exports = function (RED) {
104
105
  to: to,
105
106
  cc: cc,
106
107
  bcc: bcc,
108
+ replyTo: replyTo,
107
109
  subject: subject,
108
110
  html: Buffer.from(htmlContent, 'utf-8'),
109
111
  attachments: processedAttachments,
@@ -155,8 +157,6 @@ module.exports = function (RED) {
155
157
  });
156
158
  }
157
159
 
158
- RED.nodes.registerType('email-sender', EmailSenderNode);
159
-
160
160
  function safeEvaluatePropertyAttachment(config, node, msg) {
161
161
  if (config.attachments && config.attachments.trim() !== '') {
162
162
  try {
@@ -169,4 +169,10 @@ module.exports = function (RED) {
169
169
 
170
170
  return null;
171
171
  }
172
+
173
+ RED.nodes.registerType('email-sender', EmailSenderNode, {
174
+ credentials: {
175
+ password: { type: 'password' },
176
+ },
177
+ });
172
178
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube-tools",
3
- "version": "1.0.1-feature-9a380c-mfm58gob",
3
+ "version": "1.0.1-feature-709a7c-mfnlsw5g",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED tools nodes for ProcessCube",
6
6
  "scripts": {