@5minds/node-red-contrib-processcube-tools 1.0.1-feature-48c9c8-mff7tax3 → 1.0.1-feature-4d41c0-mff7tr8d

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.
package/.env.template ADDED
@@ -0,0 +1,4 @@
1
+ EMAIL_SEND_PORT=
2
+ EMAIL_SEND_HOST=
3
+ EMAIL_SEND_USER=
4
+ EMAIL_SEND_PASSWORD=
@@ -0,0 +1,257 @@
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType('email-sender', {
3
+ category: 'ProcessCube Tools',
4
+ color: '#02AFD6',
5
+ defaults: {
6
+ name: { value: "" },
7
+ // Mail fields
8
+ sender: { value: "Stoelting Ticket-System", required: true, validate: RED.validators.typedInput("senderType") },
9
+ senderType: { value: "str" },
10
+ address: { value: "", required: true, validate: RED.validators.typedInput("addressType") },
11
+ addressType: { value: "str" },
12
+ to: { value: "", required: true, validate: RED.validators.typedInput("toType") },
13
+ toType: { value: "str" },
14
+ cc: { value: "", validate: RED.validators.typedInput("ccType") },
15
+ ccType: { value: "str" },
16
+ bcc: { value: "", validate: RED.validators.typedInput("bccType") },
17
+ bccType: { value: "str" },
18
+ subject: { value: "", required: true, validate: RED.validators.typedInput("subjectType") },
19
+ subjectType: { value: "str" },
20
+ attachments: { value: "", validate: RED.validators.typedInput("attachmentsType") },
21
+ attachmentsType: { value: "msg" },
22
+ htmlContent: { value: "", required: true, validate: RED.validators.typedInput("htmlContentType") },
23
+ htmlContentType: { value: "str" },
24
+
25
+ // SMTP-Fields
26
+ host: { value: "", required: true, validate: RED.validators.typedInput("hostType") },
27
+ hostType: { value: "str" },
28
+ port: { value: "", required: true, validate: RED.validators.typedInput("portType") },
29
+ portType: { value: "num" },
30
+ user: { value: "", required: true, validate: RED.validators.typedInput("userType") },
31
+ userType: { value: "str" },
32
+ password: { value: "", required: true, type: "password" },
33
+ passwordType: { value: "env", required: true },
34
+ secure: { value: "", required: true, validate: RED.validators.typedInput("secureType") },
35
+ secureType: { value: "bool" },
36
+ rejectUnauthorized: { value: "", required: true, validate: RED.validators.typedInput("rejectUnauthorizedType") },
37
+ rejectUnauthorizedType: { value: "bool" }
38
+ },
39
+ inputs: 1,
40
+ outputs: 1,
41
+ icon: "font-awesome/fa-paper-plane",
42
+ label: function() {
43
+ return this.name || "Email Sender";
44
+ },
45
+ oneditprepare: function() {
46
+ // Mail Fields
47
+ $('#node-input-sender').typedInput({
48
+ default: 'str',
49
+ types: ['str', 'msg', 'flow', 'global', 'env'],
50
+ typeField: '#node-input-senderType'
51
+ });
52
+ $('#node-input-address').typedInput({
53
+ default: 'str',
54
+ types: ['str', 'msg', 'flow', 'global', 'env'],
55
+ typeField: '#node-input-addressType'
56
+ });
57
+ $('#node-input-to').typedInput({
58
+ default: 'str',
59
+ types: ['str', 'msg', 'flow', 'global', 'env'],
60
+ typeField: '#node-input-toType'
61
+ });
62
+ $('#node-input-cc').typedInput({
63
+ default: 'str',
64
+ types: ['str', 'msg', 'flow', 'global', 'env'],
65
+ typeField: '#node-input-ccType'
66
+ });
67
+ $('#node-input-bcc').typedInput({
68
+ default: 'str',
69
+ types: ['str', 'msg', 'flow', 'global', 'env'],
70
+ typeField: '#node-input-bccType'
71
+ });
72
+ $('#node-input-subject').typedInput({
73
+ default: 'str',
74
+ types: ['str', 'msg', 'flow', 'global', 'env'],
75
+ typeField: '#node-input-subjectType'
76
+ });
77
+ $('#node-input-attachments').typedInput({
78
+ default: 'msg',
79
+ types: ['msg', 'flow', 'global'],
80
+ typeField: '#node-input-attachmentsType'
81
+ });
82
+ $('#node-input-htmlContent').typedInput({
83
+ default: 'str',
84
+ types: ['str', 'msg', 'flow', 'global', 'json'],
85
+ typeField: '#node-input-htmlContentType'
86
+ });
87
+
88
+ // SMTP Fields
89
+ $('#node-input-host').typedInput({
90
+ default: 'str',
91
+ types: ['str', 'msg', 'flow', 'global', 'env'],
92
+ typeField: '#node-input-hostType'
93
+ });
94
+ $('#node-input-port').typedInput({
95
+ default: 'num',
96
+ types: ['num', 'msg', 'flow', 'global', 'env'],
97
+ typeField: '#node-input-portType'
98
+ });
99
+ $('#node-input-user').typedInput({
100
+ default: 'str',
101
+ types: ['str', 'msg', 'flow', 'global', 'env'],
102
+ typeField: '#node-input-userType'
103
+ });
104
+ $('#node-input-password').typedInput({
105
+ default: 'env',
106
+ types: ['msg', 'flow', 'global', 'env'],
107
+ typeField: '#node-input-passwordType'
108
+ });
109
+ $('#node-input-secure').typedInput({
110
+ default: 'bool',
111
+ types: ['bool', 'msg', 'flow', 'global', 'env'],
112
+ typeField: '#node-input-secureType'
113
+ });
114
+ $('#node-input-rejectUnauthorized').typedInput({
115
+ default: 'bool',
116
+ types: ['bool', 'msg', 'flow', 'global', 'env'],
117
+ typeField: '#node-input-rejectUnauthorizedType'
118
+ });
119
+ }
120
+ });
121
+ </script>
122
+
123
+ <script type="text/html" data-template-name="email-sender">
124
+ <div class="form-row">
125
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
126
+ <input type="text" id="node-input-name" placeholder="Name">
127
+ </div>
128
+
129
+ <h3>Mail Configuration</h3>
130
+ <div class="form-row">
131
+ <label for="node-input-sender"><i class="fa fa-user"></i> Sender</label>
132
+ <input type="text" id="node-input-sender" placeholder="John Doe">
133
+ <input type="hidden" id="node-input-senderType">
134
+ </div>
135
+ <div class="form-row">
136
+ <label for="node-input-address"><i class="fa fa-envelope"></i> Address</label>
137
+ <input type="text" id="node-input-address" placeholder="john.doe@example.com">
138
+ <input type="hidden" id="node-input-addressType">
139
+ </div>
140
+ <div class="form-row">
141
+ <label for="node-input-to"><i class="fa fa-user"></i> To</label>
142
+ <input type="text" id="node-input-to" placeholder="my.test@example.com">
143
+ <input type="hidden" id="node-input-toType">
144
+ </div>
145
+ <div class="form-row">
146
+ <label for="node-input-cc"><i class="fa fa-user-plus"></i> CC</label>
147
+ <input type="text" id="node-input-cc">
148
+ <input type="hidden" id="node-input-ccType">
149
+ </div>
150
+ <div class="form-row">
151
+ <label for="node-input-bcc"><i class="fa fa-user-secret"></i> BCC</label>
152
+ <input type="text" id="node-input-bcc">
153
+ <input type="hidden" id="node-input-bccType">
154
+ </div>
155
+ <div class="form-row">
156
+ <label for="node-input-subject"><i class="fa fa-info-circle"></i> Subject</label>
157
+ <input type="text" id="node-input-subject">
158
+ <input type="hidden" id="node-input-subjectType">
159
+ </div>
160
+ <div class="form-row">
161
+ <label for="node-input-attachments"><i class="fa fa-paperclip"></i> Attachments</label>
162
+ <input type="text" id="node-input-attachments">
163
+ <input type="hidden" id="node-input-attachmentsType">
164
+ </div>
165
+ <div class="form-row">
166
+ <label for="node-input-htmlContent"><i class="fa fa-file-code-o"></i> HTML Content</label>
167
+ <input type="text" id="node-input-htmlContent">
168
+ <input type="hidden" id="node-input-htmlContentType">
169
+ </div>
170
+
171
+ <h3>SMTP Configuration</h3>
172
+ <div class="form-row">
173
+ <label for="node-input-host"><i class="fa fa-server"></i> Host</label>
174
+ <input type="text" id="node-input-host" placeholder="smtp.gmail.com">
175
+ <input type="hidden" id="node-input-hostType">
176
+ </div>
177
+ <div class="form-row">
178
+ <label for="node-input-port"><i class="fa fa-plug"></i> Port</label>
179
+ <input type="text" id="node-input-port" placeholder="587">
180
+ <input type="hidden" id="node-input-portType">
181
+ </div>
182
+ <div class="form-row">
183
+ <label for="node-input-user"><i class="fa fa-user"></i> User</label>
184
+ <input type="text" id="node-input-user" placeholder="test.user@config.com">
185
+ <input type="hidden" id="node-input-userType">
186
+ </div>
187
+ <div class="form-row">
188
+ <label for="node-input-password"><i class="fa fa-lock"></i> Password</label>
189
+ <input type="password" id="node-input-password">
190
+ <input type="hidden" id="node-input-passwordType">
191
+ </div>
192
+ <div class="form-row">
193
+ <label for="node-input-secure"><i class="fa fa-shield"></i> SSL/TLS (Secure)</label>
194
+ <input type="text" id="node-input-secure">
195
+ <input type="hidden" id="node-input-secureType">
196
+ </div>
197
+ <div class="form-row">
198
+ <label for="node-input-rejectUnauthorized"><i class="fa fa-ban"></i> Reject Unauthorized</label>
199
+ <input type="text" id="node-input-rejectUnauthorized">
200
+ <input type="hidden" id="node-input-rejectUnauthorizedType">
201
+ </div>
202
+ </script>
203
+
204
+ <script type="text/html" data-help-name="email-sender">
205
+ <p>A custom node to send emails using an SMTP server. The configuration for each field can be sourced from a fixed value, or from a <code>msg</code>, <code>flow</code>, <code>global</code>, or <code>env</code> variable.</p>
206
+
207
+ <h3>Configuration</h3>
208
+ <p>Every field on the configuration panel is a <b>typed input</b>. Use the dropdown menu next to each field to select the source of its value. Note that <b>Sender</b>, <b>Address</b>, <b>To</b>, <b>Subject</b>, and <b>HTML Content</b> are required fields and must be configured before the node can be deployed.</p>
209
+
210
+ <h4>Mail Configuration</h4>
211
+ <dl class="message-properties">
212
+ <dt>Sender <span class="property-type">string | variable</span></dt>
213
+ <dd>The name of the sender, as displayed to the recipient.</dd>
214
+
215
+ <dt>Address <span class="property-type">string | variable</span></dt>
216
+ <dd>The sender's email address.</dd>
217
+
218
+ <dt>To <span class="property-type">string | variable</span></dt>
219
+ <dd>The primary recipient's email address. Separate multiple addresses with a comma.</dd>
220
+
221
+ <dt>CC <span class="property-type">string | variable</span></dt>
222
+ <dd>Addresses to be carbon-copied on the email.</dd>
223
+
224
+ <dt>BCC <span class="property-type">string | variable</span></dt>
225
+ <dd>Addresses to be blind-carbon-copied on the email.</dd>
226
+
227
+ <dt>Subject <span class="property-type">string | variable</span></dt>
228
+ <dd>The subject line of the email.</dd>
229
+
230
+ <dt>Attachments <span class="property-type">array | variable</span></dt>
231
+ <dd>A list of file attachments. This should be a variable containing an array of attachment objects.</dd>
232
+
233
+ <dt>HTML Content <span class="property-type">string | variable</span></dt>
234
+ <dd>The HTML body of the email.</dd>
235
+ </dl>
236
+
237
+ <h4>SMTP Configuration</h4>
238
+ <dl class="message-properties">
239
+ <dt>Host <span class="property-type">string | variable</span></dt>
240
+ <dd>The hostname or IP address of the SMTP server.</dd>
241
+
242
+ <dt>Port <span class="property-type">number | variable</span></dt>
243
+ <dd>The port number of the SMTP server.</dd>
244
+
245
+ <dt>User <span class="property-type">string | variable</span></dt>
246
+ <dd>The username for SMTP authentication.</dd>
247
+
248
+ <dt>Password <span class="property-type">string | variable</span></dt>
249
+ <dd>The password for SMTP authentication.</dd>
250
+
251
+ <dt>SSL/TLS (Secure) <span class="property-type">boolean | variable</span></dt>
252
+ <dd>Use a secure connection. Set to <code>true</code> for SSL/TLS, <code>false</code> for a non-secure connection.</dd>
253
+
254
+ <dt>Reject Unauthorized <span class="property-type">boolean | variable</span></dt>
255
+ <dd>If <code>true</code>, the server's certificate is rejected if it's not authorized by a trusted CA.</dd>
256
+ </dl>
257
+ </script>
@@ -0,0 +1,91 @@
1
+ module.exports = function(RED) {
2
+ "use strict";
3
+ const nodemailer = require("nodemailer");
4
+
5
+ function EmailSenderNode(config) {
6
+ RED.nodes.createNode(this, config);
7
+ var node = this;
8
+
9
+ node.on('input', function(msg, send, done) {
10
+ send = send || function() { node.send.apply(node, arguments); };
11
+ done = done || function(err) { if (err) node.error(err, msg); };
12
+
13
+ // Retrieve and evaluate mail configuration values
14
+ const sender = RED.util.evaluateNodeProperty(config.sender, config.senderType, node, msg);
15
+ const address = RED.util.evaluateNodeProperty(config.address, config.addressType, node, msg);
16
+ const to = RED.util.evaluateNodeProperty(config.to, config.toType, node, msg);
17
+ const cc = RED.util.evaluateNodeProperty(config.cc, config.ccType, node, msg) || "";
18
+ const bcc = RED.util.evaluateNodeProperty(config.bcc, config.bccType, node, msg) || "";
19
+ const subject = RED.util.evaluateNodeProperty(config.subject, config.subjectType, node, msg) || msg.topic || "Message from Node-RED";
20
+ const attachments = RED.util.evaluateNodeProperty(config.attachments, config.attachmentsType, node, msg);
21
+ const htmlContent = RED.util.evaluateNodeProperty(config.htmlContent, config.htmlContentType, node, msg);
22
+
23
+ // Retrieve and evaluate SMTP configuration values
24
+ const host = RED.util.evaluateNodeProperty(config.host, config.hostType, node, msg);
25
+ const port = RED.util.evaluateNodeProperty(config.port, config.portType, node, msg);
26
+ const user = RED.util.evaluateNodeProperty(config.user, config.userType, node, msg);
27
+ const password = RED.util.evaluateNodeProperty(config.password, config.passwordType, node, msg);
28
+ const secure = RED.util.evaluateNodeProperty(config.secure, config.secureType, node, msg);
29
+ const rejectUnauthorized = RED.util.evaluateNodeProperty(config.rejectUnauthorized, config.rejectUnauthorizedType, node, msg);
30
+
31
+ // Create SMTP transporter
32
+ const transporter = nodemailer.createTransport({
33
+ host: host,
34
+ port: port,
35
+ secure: secure,
36
+ auth: {
37
+ user: user,
38
+ pass: password
39
+ },
40
+ tls: {
41
+ rejectUnauthorized: rejectUnauthorized
42
+ }
43
+ });
44
+
45
+ // Create email object
46
+ const mailOptions = {
47
+ from: {
48
+ name: sender,
49
+ address: address
50
+ },
51
+ to: to,
52
+ cc: cc,
53
+ bcc: bcc,
54
+ subject: subject,
55
+ html: Buffer.from(htmlContent, 'utf-8'),
56
+ attachments: attachments
57
+ };
58
+
59
+ // Send email
60
+ transporter.sendMail(mailOptions, (error, info) => {
61
+ if (error) {
62
+ node.status({ fill: "red", shape: "dot", text: "error sending" });
63
+ done(error);
64
+ } else {
65
+ node.log('Email sent: ' + info.response);
66
+ msg.payload = info;
67
+
68
+ if (msg.payload.accepted && msg.payload.accepted.length > 0) {
69
+ msg.payload = msg.input;
70
+ node.status({ fill: "green", shape: "dot", text: "sent" });
71
+ send(msg);
72
+ done();
73
+ } else if (msg.payload.rejected && msg.payload.rejected.length > 0) {
74
+ msg.error = { result: msg.payload.rejected };
75
+ node.status({ fill: "red", shape: "dot", text: "rejected" });
76
+ done(new Error('Email rejected: ' + msg.payload.rejected.join(', ')));
77
+ } else if (msg.payload.pending && msg.payload.pending.length > 0) {
78
+ msg.error = { result: msg.payload.pending };
79
+ node.status({ fill: "yellow", shape: "dot", text: "pending" });
80
+ done(new Error('Email pending: ' + msg.payload.pending.join(', ')));
81
+ } else {
82
+ node.status({ fill: "red", shape: "dot", text: "unknown error" });
83
+ done(new Error('Unknown error while sending email.'));
84
+ }
85
+ }
86
+ });
87
+ });
88
+ }
89
+
90
+ RED.nodes.registerType("email-sender", EmailSenderNode);
91
+ };
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-48c9c8-mff7tax3",
3
+ "version": "1.0.1-feature-4d41c0-mff7tr8d",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED tools nodes for ProcessCube",
6
6
  "scripts": {
@@ -14,10 +14,6 @@
14
14
  {
15
15
  "name": "Robin Lenz",
16
16
  "email": "Robin.Lenz@5Minds.de"
17
- },
18
- {
19
- "name": "Diana Stefan",
20
- "email": "Diana.Stefan@5Minds.de"
21
17
  }
22
18
  ],
23
19
  "repository": {
@@ -35,27 +31,14 @@
35
31
  "node-red": {
36
32
  "version": ">=3.1.9",
37
33
  "nodes": {
38
- "EmailReceiver": "email-receiver/email-receiver.js",
39
- "HtmlToText": "processcube-html-to-text.js"
34
+ "EmailSender": "email-sender/email-sender.js",
35
+ "HtmlToText": "processcube-html-to-text/processcube-html-to-text.js"
40
36
  },
41
37
  "examples": "examples"
42
38
  },
43
39
  "dependencies": {
44
40
  "html-to-text": "^9.0.5",
45
- "mailparser": "^3.6.8",
46
- "node-imap": "^0.9.6",
47
- "utf7": "^1.0.2"
48
- },
49
- "devDependencies": {
50
- "chai": "^4.3.4",
51
- "mocha": "^11.7.2",
52
- "node-red": "^4.1.0",
53
- "node-red-node-test-helper": "^0.3.5",
54
- "should": "^13.2.3",
55
- "sinon": "^11.1.2"
56
- },
57
- "overrides": {
58
- "semver": ">=7.5.2"
41
+ "nodemailer": "^7.0.6"
59
42
  },
60
43
  "keywords": [
61
44
  "node-red",
@@ -1,187 +0,0 @@
1
- <script type="text/javascript">
2
- RED.nodes.registerType('email-receiver', {
3
- category: 'ProcessCube Tools',
4
- color: '#02AFD6',
5
- defaults: {
6
- name: { value: "" },
7
- host: { value: "", required: true, validate: RED.validators.typedInput("hostType") },
8
- hostType: { value: "str" },
9
- port: { value: "", required: true, validate: RED.validators.typedInput("portType") },
10
- portType: { value: "num" },
11
- tls: { value: true, required: true, validate: RED.validators.typedInput("tlsType") },
12
- tlsType: { value: "bool" },
13
- user: { value: "", required: true, validate: RED.validators.typedInput("userType") },
14
- userType: { value: "str" },
15
- password: { value: "", required: true, type: "password" },
16
- passwordType: { value: "env", required: true },
17
- folder: { value: "", required: true, validate: RED.validators.typedInput("folderType") },
18
- folderType: { value: "json" },
19
- markseen: { value: true, validate: RED.validators.typedInput("markseenType") },
20
- markseenType: { value: "bool" }
21
- },
22
- inputs: 1,
23
- outputs: 1,
24
- icon: "font-awesome/fa-inbox",
25
- label: function() {
26
- return this.name || "E-Mail Receiver";
27
- },
28
- oneditprepare: function() {
29
- $('#node-input-host').typedInput({
30
- default: 'str',
31
- types: ['str', 'msg', 'flow', 'global', 'env'],
32
- typeField: '#node-input-hostType'
33
- });
34
-
35
- $('#node-input-port').typedInput({
36
- default: 'num',
37
- types: ['num', 'msg', 'flow', 'global', 'env'],
38
- typeField: '#node-input-portType'
39
- });
40
-
41
- $('#node-input-tls').typedInput({
42
- default: 'bool',
43
- types: ['bool', 'msg', 'flow', 'global', 'env'],
44
- typeField: '#node-input-tlsType'
45
- });
46
-
47
- $('#node-input-user').typedInput({
48
- default: 'str',
49
- types: ['str', 'msg', 'flow', 'global', 'env'],
50
- typeField: '#node-input-userType'
51
- });
52
-
53
- $('#node-input-password').typedInput({
54
- default: 'env',
55
- types: ['msg', 'flow', 'global', 'env'],
56
- typeField: '#node-input-passwordType'
57
- });
58
-
59
- $('#node-input-folder').typedInput({
60
- default: 'json',
61
- types: ['msg', 'flow', 'global', 'json', 'jsonata', 'env'],
62
- typeField: '#node-input-folderType'
63
- });
64
-
65
- $('#node-input-markseen').typedInput({
66
- default: 'bool',
67
- types: ['bool', 'msg', 'flow', 'global', 'env'],
68
- typeField: '#node-input-markseenType'
69
- });
70
- }
71
- });
72
- </script>
73
-
74
- <script type="text/html" data-template-name="email-receiver">
75
- <div class="form-row">
76
- <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
77
- <input type="text" id="node-input-name" placeholder="Name">
78
- </div>
79
-
80
- <div class="form-row">
81
- <label for="node-input-host"><i class="fa fa-server"></i> IMAP Host</label>
82
- <input type="text" id="node-input-host" placeholder="imap.gmail.com">
83
- <input type="hidden" id="node-input-hostType">
84
- </div>
85
-
86
- <div class="form-row">
87
- <label for="node-input-port"><i class="fa fa-terminal"></i> Port</label>
88
- <input type="text" id="node-input-port" placeholder="993">
89
- <input type="hidden" id="node-input-portType">
90
- </div>
91
-
92
- <div class="form-row">
93
- <label for="node-input-tls"><i class="fa fa-lock"></i> Use TLS</label>
94
- <input type="text" id="node-input-tls">
95
- <input type="hidden" id="node-input-tlsType">
96
- </div>
97
-
98
- <div class="form-row">
99
- <label for="node-input-user"><i class="fa fa-user"></i> User</label>
100
- <input type="text" id="node-input-user">
101
- <input type="hidden" id="node-input-userType">
102
- </div>
103
-
104
- <div class="form-row">
105
- <label for="node-input-password"><i class="fa fa-key"></i> Password</label>
106
- <input type="text" id="node-input-password">
107
- <input type="hidden" id="node-input-passwordType">
108
- </div>
109
-
110
- <div class="form-row">
111
- <label for="node-input-folder"><i class="fa fa-folder-open"></i> Folder(s)</label>
112
- <input type="text" id="node-input-folder" placeholder="[INBOX]">
113
- <input type="hidden" id="node-input-folderType">
114
- </div>
115
-
116
- <div class="form-row">
117
- <label for="node-input-markseen"><i class="fa fa-eye"></i> Mark as seen</label>
118
- <input type="text" id="node-input-markseen">
119
- <input type="hidden" id="node-input-markseenType">
120
- </div>
121
- </script>
122
-
123
- <script type="text/html" data-help-name="email-receiver">
124
- <p>A Node-RED node that fetches unseen emails from a specified IMAP server. Each fetched email is sent as a separate message on the output.</p>
125
-
126
- <p>All fields can be configured as a <strong>string</strong>, from a <strong>message property (msg)</strong>, <strong>flow</strong> or <strong>global</strong> context, or an <strong>environment variable</strong>.</p>
127
-
128
- <p><strong>Security Tip:</strong> It's a best practice to avoid storing sensitive information like passwords directly in your Node-RED flow. This prevents them from being exposed in your flow file. Instead, use an <strong>environment variable</strong>. You can define these variables in a <code>.env</code> file, which is especially useful when deploying your application with Docker.</p>
129
-
130
- <p>A <code>.env</code> file should look like this:</p>
131
- <pre>
132
- EMAIL_SEND_PORT=123
133
- EMAIL_SEND_HOST=smtp.gmail.com
134
- EMAIL_SEND_USER=myTestMail@company.com
135
- EMAIL_SEND_PASSWORD=mySecretPassword
136
- </pre>
137
-
138
- <p>To ensure Docker loads these variables from the <code>.env</code> file, you need to add the following line to your <code>docker-compose.yaml</code> file:</p>
139
- <pre>
140
- services:
141
- your_service_name:
142
- ...
143
- env_file:
144
- - .env
145
- </pre>
146
-
147
- <p>In your flow, you can then access the password using the environment variable <code>EMAIL_SEND_PASSWORD</code>.</p>
148
-
149
- Inputs
150
- <dl class="message-properties">
151
- <dt>payload</dt>
152
- <dd>The node is triggered by any incoming message. The node's configuration can be overridden by properties of the incoming <code>msg</code> object.</dd>
153
- </dl>
154
-
155
- Outputs
156
- <dl class="message-properties">
157
- <dt>payload
158
- <span class="property-type">string</span>
159
- </dt>
160
- <dd>The text body of the email.</dd>
161
- </dl>
162
-
163
- Optional Message Properties
164
- <p>You can override default settings by passing the following properties in the incoming <code>msg</code> object:</p>
165
- <dl class="message-properties">
166
- <dt>msg.imap_connTimeout
167
- <span class="property-type">number</span>
168
- </dt>
169
- <dd>The connection timeout in milliseconds (default: 10000).</dd>
170
- <dt>msg.imap_authTimeout
171
- <span class="property-type">number</span>
172
- </dt>
173
- <dd>The authentication timeout in milliseconds (default: 5000).</dd>
174
- <dt>msg.imap_keepalive
175
- <span class="property-type">boolean</span>
176
- </dt>
177
- <dd>If set to <code>true</code>, a periodic NOOP command is sent to keep the connection alive (default: <code>true</code>).</dd>
178
- <dt>msg.imap_autotls
179
- <span class="property-type">string</span>
180
- </dt>
181
- <dd>Controls STARTTLS behavior. Set to <code>never</code> to disable it (default: <code>never</code>).</dd>
182
- <dt>msg.imap_tlsOptions
183
- <span class="property-type">object</span>
184
- </dt>
185
- <dd>An object containing TLS options for the connection.</dd>
186
- </dl>
187
- </script>