@5minds/node-red-contrib-processcube-tools 1.2.0-feature-8f3d72-mg9cplxi → 1.2.0-feature-6d921c-mgp4itmd
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 +1 -7
- package/.mocharc.json +5 -0
- package/dist/email-receiver/email-receiver.d.ts +3 -0
- package/{email-receiver → dist/email-receiver}/email-receiver.html +4 -82
- package/dist/email-receiver/email-receiver.js +342 -0
- package/dist/email-receiver/email-receiver.js.map +1 -0
- package/dist/email-sender/email-sender.d.ts +3 -0
- package/dist/email-sender/email-sender.js +183 -0
- package/dist/email-sender/email-sender.js.map +1 -0
- package/dist/html-to-text/html-to-text.d.ts +3 -0
- package/{processcube-html-to-text/processcube-html-to-text.html → dist/html-to-text/html-to-text.html} +3 -3
- package/dist/html-to-text/html-to-text.js +40 -0
- package/dist/html-to-text/html-to-text.js.map +1 -0
- package/dist/imap-config/imap-config.d.ts +3 -0
- package/dist/imap-config/imap-config.html +139 -0
- package/dist/imap-config/imap-config.js +22 -0
- package/dist/imap-config/imap-config.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/EmailReceiverMessage.d.ts +20 -0
- package/dist/interfaces/EmailReceiverMessage.js +3 -0
- package/dist/interfaces/EmailReceiverMessage.js.map +1 -0
- package/dist/interfaces/EmailSenderNodeProperties.d.ts +33 -0
- package/dist/interfaces/EmailSenderNodeProperties.js +3 -0
- package/dist/interfaces/EmailSenderNodeProperties.js.map +1 -0
- package/dist/interfaces/FetchState.d.ts +11 -0
- package/dist/interfaces/FetchState.js +3 -0
- package/dist/interfaces/FetchState.js.map +1 -0
- package/dist/interfaces/ImapConnectionConfig.d.ts +16 -0
- package/dist/interfaces/ImapConnectionConfig.js +3 -0
- package/dist/interfaces/ImapConnectionConfig.js.map +1 -0
- package/package.json +27 -17
- package/tsconfig.json +23 -0
- package/email-receiver/email-receiver.js +0 -304
- package/email-sender/email-sender.js +0 -178
- package/examples/.gitkeep +0 -0
- package/file-storage/file-storage.html +0 -203
- package/file-storage/file-storage.js +0 -148
- package/processcube-html-to-text/processcube-html-to-text.js +0 -22
- package/storage/providers/fs.js +0 -117
- package/storage/providers/postgres.js +0 -160
- package/storage/storage-core.js +0 -77
- package/test/helpers/email-receiver.mocks.js +0 -447
- package/test/helpers/email-sender.mocks.js +0 -368
- package/test/integration/email-receiver.integration.test.js +0 -515
- package/test/integration/email-sender.integration.test.js +0 -239
- package/test/unit/email-receiver.unit.test.js +0 -304
- package/test/unit/email-sender.unit.test.js +0 -570
- /package/{email-sender → dist/email-sender}/email-sender.html +0 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const nodemailer_1 = __importDefault(require("nodemailer"));
|
|
6
|
+
// Default dependencies - production values
|
|
7
|
+
const defaultDependencies = {
|
|
8
|
+
nodemailer: nodemailer_1.default,
|
|
9
|
+
};
|
|
10
|
+
const EmailSenderNode = (RED, dependencies = defaultDependencies) => {
|
|
11
|
+
function EmailSender(config) {
|
|
12
|
+
RED.nodes.createNode(this, config);
|
|
13
|
+
const node = this;
|
|
14
|
+
const validateRequiredProperties = (cfg) => {
|
|
15
|
+
const requiredFields = [
|
|
16
|
+
{ name: 'sender', value: cfg.sender },
|
|
17
|
+
{ name: 'address', value: cfg.address },
|
|
18
|
+
{ name: 'to', value: cfg.to },
|
|
19
|
+
{ name: 'subject', value: cfg.subject },
|
|
20
|
+
{ name: 'htmlContent', value: cfg.htmlContent },
|
|
21
|
+
{ name: 'host', value: cfg.host },
|
|
22
|
+
{ name: 'port', value: cfg.port },
|
|
23
|
+
{ name: 'user', value: cfg.user },
|
|
24
|
+
{ name: 'password', value: cfg.password },
|
|
25
|
+
{ name: 'secure', value: cfg.secure },
|
|
26
|
+
{ name: 'rejectUnauthorized', value: cfg.rejectUnauthorized },
|
|
27
|
+
];
|
|
28
|
+
for (const field of requiredFields) {
|
|
29
|
+
if (field.value === undefined || field.value === null || field.value === '') {
|
|
30
|
+
return `Required property '${field.name}' is missing`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
};
|
|
35
|
+
const validationError = validateRequiredProperties(config);
|
|
36
|
+
if (validationError) {
|
|
37
|
+
node.status({ fill: 'red', shape: 'dot', text: 'configuration error' });
|
|
38
|
+
setImmediate(() => {
|
|
39
|
+
node.error(validationError);
|
|
40
|
+
});
|
|
41
|
+
return; // Stop initialization if config is invalid
|
|
42
|
+
}
|
|
43
|
+
const safeEvaluatePropertyAttachment = (cfg, n, m) => {
|
|
44
|
+
if (cfg.attachments && cfg.attachments.trim() !== '') {
|
|
45
|
+
try {
|
|
46
|
+
return RED.util.evaluateNodeProperty(cfg.attachments, cfg.attachmentsType, n, m);
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
n.error('Failed to evaluate attachments property: ' + e.message, m);
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
};
|
|
55
|
+
node.on('input', async (msg, send, done) => {
|
|
56
|
+
send =
|
|
57
|
+
send ||
|
|
58
|
+
function () {
|
|
59
|
+
node.send.apply(node, arguments);
|
|
60
|
+
};
|
|
61
|
+
done =
|
|
62
|
+
done ||
|
|
63
|
+
function (err) {
|
|
64
|
+
if (err)
|
|
65
|
+
node.error(err, msg);
|
|
66
|
+
};
|
|
67
|
+
try {
|
|
68
|
+
// Retrieve and evaluate all configuration values
|
|
69
|
+
const sender = String(RED.util.evaluateNodeProperty(config.sender, config.senderType, node, msg));
|
|
70
|
+
const address = String(RED.util.evaluateNodeProperty(config.address, config.addressType, node, msg));
|
|
71
|
+
const to = String(RED.util.evaluateNodeProperty(config.to, config.toType, node, msg) || '');
|
|
72
|
+
const cc = String(RED.util.evaluateNodeProperty(config.cc, config.ccType, node, msg) || '');
|
|
73
|
+
const bcc = String(RED.util.evaluateNodeProperty(config.bcc, config.bccType, node, msg) || '');
|
|
74
|
+
const replyTo = String(RED.util.evaluateNodeProperty(config.replyTo, config.replyToType, node, msg) || '');
|
|
75
|
+
const subject = String(RED.util.evaluateNodeProperty(config.subject, config.subjectType, node, msg) ||
|
|
76
|
+
msg.topic ||
|
|
77
|
+
'Message from Node-RED');
|
|
78
|
+
const htmlContent = String(RED.util.evaluateNodeProperty(config.htmlContent, config.htmlContentType, node, msg));
|
|
79
|
+
const attachments = safeEvaluatePropertyAttachment(config, node, msg);
|
|
80
|
+
// SMTP Configuration
|
|
81
|
+
const host = String(RED.util.evaluateNodeProperty(config.host, config.hostType, node, msg));
|
|
82
|
+
const port = Number(RED.util.evaluateNodeProperty(config.port, config.portType, node, msg));
|
|
83
|
+
const user = String(RED.util.evaluateNodeProperty(config.user, config.userType, node, msg));
|
|
84
|
+
const password = String(RED.util.evaluateNodeProperty(config.password, config.passwordType, node, msg));
|
|
85
|
+
const secure = Boolean(RED.util.evaluateNodeProperty(config.secure, config.secureType, node, msg));
|
|
86
|
+
const rejectUnauthorized = Boolean(RED.util.evaluateNodeProperty(config.rejectUnauthorized, config.rejectUnauthorizedType, node, msg));
|
|
87
|
+
// Process attachments
|
|
88
|
+
let processedAttachments = [];
|
|
89
|
+
let parsedAttachments = attachments;
|
|
90
|
+
if (typeof parsedAttachments === 'string' && parsedAttachments.trim().startsWith('[')) {
|
|
91
|
+
try {
|
|
92
|
+
parsedAttachments = JSON.parse(parsedAttachments);
|
|
93
|
+
}
|
|
94
|
+
catch (e) {
|
|
95
|
+
throw new Error('Failed to parse attachments JSON: ' + e.message);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (parsedAttachments) {
|
|
99
|
+
const attachmentArray = Array.isArray(parsedAttachments) ? parsedAttachments : [parsedAttachments];
|
|
100
|
+
for (const attachment of attachmentArray) {
|
|
101
|
+
if (typeof attachment === 'object' && attachment !== null) {
|
|
102
|
+
if (attachment.filename && attachment.content !== undefined) {
|
|
103
|
+
processedAttachments.push({
|
|
104
|
+
filename: attachment.filename,
|
|
105
|
+
content: attachment.content,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
throw new Error(`Attachment object is missing 'filename' or 'content' property. Got: ${JSON.stringify(attachment)}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
throw new Error(`Invalid attachment format. Expected object, got: ${typeof attachment}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// Create and send email
|
|
118
|
+
const transporter = dependencies.nodemailer.createTransport({
|
|
119
|
+
host,
|
|
120
|
+
port,
|
|
121
|
+
secure,
|
|
122
|
+
auth: { user, pass: password },
|
|
123
|
+
tls: { rejectUnauthorized },
|
|
124
|
+
});
|
|
125
|
+
const mailOptions = {
|
|
126
|
+
from: { name: sender, address: address },
|
|
127
|
+
to,
|
|
128
|
+
cc,
|
|
129
|
+
bcc,
|
|
130
|
+
replyTo,
|
|
131
|
+
subject,
|
|
132
|
+
html: Buffer.from(htmlContent, 'utf-8'),
|
|
133
|
+
attachments: processedAttachments,
|
|
134
|
+
};
|
|
135
|
+
transporter.sendMail(mailOptions, (error, info) => {
|
|
136
|
+
if (error) {
|
|
137
|
+
node.status({ fill: 'red', shape: 'dot', text: 'error sending' });
|
|
138
|
+
if (error.message &&
|
|
139
|
+
error.message.includes('SSL routines') &&
|
|
140
|
+
error.message.includes('wrong version number')) {
|
|
141
|
+
done(new Error('SSL/TLS connection failed: Wrong version number. This usually means the wrong port or security settings are used. For SMTP: use port 587 with secure=false (STARTTLS) or port 465 with secure=true (SSL/TLS).'));
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
done(error);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
node.log('Email sent: ' + info.response);
|
|
149
|
+
msg.payload = info;
|
|
150
|
+
if (info.accepted && info.accepted.length > 0) {
|
|
151
|
+
node.status({ fill: 'green', shape: 'dot', text: 'sent' });
|
|
152
|
+
send(msg);
|
|
153
|
+
done();
|
|
154
|
+
}
|
|
155
|
+
else if (info.rejected && info.rejected.length > 0) {
|
|
156
|
+
done(new Error('Email rejected: ' + info.rejected.join(', ')));
|
|
157
|
+
node.status({ fill: 'red', shape: 'dot', text: 'rejected' });
|
|
158
|
+
}
|
|
159
|
+
else if (info.pending && info.pending.length > 0) {
|
|
160
|
+
done(new Error('Email pending: ' + info.pending.join(', ')));
|
|
161
|
+
node.status({ fill: 'yellow', shape: 'dot', text: 'pending' });
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
done(new Error('Unknown error while sending email.'));
|
|
165
|
+
node.status({ fill: 'red', shape: 'dot', text: 'unknown error' });
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
done(error instanceof Error ? error : new Error(String(error)));
|
|
172
|
+
node.status({ fill: 'red', shape: 'dot', text: 'error' });
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
RED.nodes.registerType('email-sender', EmailSender, {
|
|
177
|
+
credentials: {
|
|
178
|
+
password: { type: 'password' },
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
module.exports = EmailSenderNode;
|
|
183
|
+
//# sourceMappingURL=email-sender.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-sender.js","sourceRoot":"","sources":["../../src/email-sender/email-sender.ts"],"names":[],"mappings":";;;;AACA,4DAAoC;AAUpC,2CAA2C;AAC3C,MAAM,mBAAmB,GAAiB;IACtC,UAAU,EAAE,oBAAU;CACzB,CAAC;AAEF,MAAM,eAAe,GAAoB,CAAC,GAAG,EAAE,eAA6B,mBAAmB,EAAE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EAAE,eAAe,EAAE,CAAC,CAAC;wBACtE,CAAC;oBACL,CAAC;gBACL,CAAC,CAAC,CAAC;YACP,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,IAAI,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAChE,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;YAC9D,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,cAAc,EAAE,WAAW,EAAE;QAChD,WAAW,EAAE;YACT,QAAQ,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;SACjC;KACJ,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,iBAAS,eAAe,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script type="text/javascript">
|
|
2
|
-
RED.nodes.registerType('
|
|
2
|
+
RED.nodes.registerType('html-to-text', {
|
|
3
3
|
category: 'ProcessCube Tools',
|
|
4
4
|
color: '#02AFD6',
|
|
5
5
|
defaults: {
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
outputs: 1,
|
|
10
10
|
icon: 'font-awesome/fa-sign-in',
|
|
11
11
|
label: function () {
|
|
12
|
-
return this.name || '
|
|
12
|
+
return this.name || 'html-to-text';
|
|
13
13
|
},
|
|
14
14
|
});
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
|
-
<script type="text/html" data-template-name="
|
|
17
|
+
<script type="text/html" data-template-name="html-to-text">
|
|
18
18
|
<div class="form-row">
|
|
19
19
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
20
20
|
<input type="text" id="node-input-name" placeholder="Name" />
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const { compile } = require('html-to-text');
|
|
3
|
+
const HtmlToTextNode = function (RED) {
|
|
4
|
+
function HtmlToText(config) {
|
|
5
|
+
RED.nodes.createNode(this, config);
|
|
6
|
+
const node = this;
|
|
7
|
+
const options = {
|
|
8
|
+
wordwrap: 130,
|
|
9
|
+
};
|
|
10
|
+
const compiledConvert = compile(options);
|
|
11
|
+
node.on('input', (msg, send, done) => {
|
|
12
|
+
// Provide default functions if not available (for older Node-RED versions)
|
|
13
|
+
send =
|
|
14
|
+
send ||
|
|
15
|
+
function (m) {
|
|
16
|
+
node.send(m);
|
|
17
|
+
};
|
|
18
|
+
done =
|
|
19
|
+
done ||
|
|
20
|
+
function (err) {
|
|
21
|
+
if (err)
|
|
22
|
+
node.error(err, msg);
|
|
23
|
+
};
|
|
24
|
+
try {
|
|
25
|
+
if (typeof msg.payload !== 'string') {
|
|
26
|
+
throw new Error('Payload is not a string!');
|
|
27
|
+
}
|
|
28
|
+
msg.payload = compiledConvert(msg.payload);
|
|
29
|
+
send(msg);
|
|
30
|
+
done();
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
done(error instanceof Error ? error : new Error(String(error)));
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
RED.nodes.registerType('html-to-text', HtmlToText);
|
|
38
|
+
};
|
|
39
|
+
module.exports = HtmlToTextNode;
|
|
40
|
+
//# sourceMappingURL=html-to-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-to-text.js","sourceRoot":"","sources":["../../src/html-to-text/html-to-text.ts"],"names":[],"mappings":";AACA,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAU5C,MAAM,cAAc,GAAoB,UAAU,GAAG;IACjD,SAAS,UAAU,CAAa,MAAgC;QAC5D,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC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3
|
+
category: 'config',
|
|
4
|
+
defaults: {
|
|
5
|
+
name: { value: '' },
|
|
6
|
+
host: { value: '', required: true },
|
|
7
|
+
port: { value: 993, required: true, validate: RED.validators.number() },
|
|
8
|
+
tls: { value: true, required: true },
|
|
9
|
+
user: { value: '', required: true, validate: RED.validators.typedInput('userType') },
|
|
10
|
+
userType: { value: 'env' },
|
|
11
|
+
password: { value: '', required: true, validate: RED.validators.typedInput('passwordType') },
|
|
12
|
+
passwordType: { value: 'env' },
|
|
13
|
+
connTimeout: { value: 10000, validate: RED.validators.number() },
|
|
14
|
+
authTimeout: { value: 5000, validate: RED.validators.number() },
|
|
15
|
+
keepalive: { value: true },
|
|
16
|
+
autotls: { value: 'never' },
|
|
17
|
+
rejectUnauthorized: { value: false },
|
|
18
|
+
},
|
|
19
|
+
label: function () {
|
|
20
|
+
return this.name || `${this.user}@${this.host}`;
|
|
21
|
+
},
|
|
22
|
+
oneditprepare: function () {
|
|
23
|
+
$('#node-config-input-user').typedInput({
|
|
24
|
+
default: 'env',
|
|
25
|
+
types: ['global', 'env'],
|
|
26
|
+
typeField: '#node-config-input-userType',
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
$('#node-config-input-password').typedInput({
|
|
30
|
+
default: 'env',
|
|
31
|
+
types: ['global', 'env'],
|
|
32
|
+
typeField: '#node-config-input-passwordType',
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<script type="text/html" data-template-name="imap-config">
|
|
39
|
+
<div class="form-row">
|
|
40
|
+
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
41
|
+
<input type="text" id="node-config-input-name" placeholder="My IMAP Server" />
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<div class="form-row">
|
|
45
|
+
<label for="node-config-input-host"><i class="fa fa-server"></i> IMAP Host</label>
|
|
46
|
+
<input type="text" id="node-config-input-host" placeholder="imap.gmail.com" />
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div class="form-row">
|
|
50
|
+
<label for="node-config-input-port"><i class="fa fa-terminal"></i> Port</label>
|
|
51
|
+
<input type="text" id="node-config-input-port" placeholder="993" />
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<div class="form-row">
|
|
55
|
+
<label for="node-config-input-tls"><i class="fa fa-lock"></i> Use TLS</label>
|
|
56
|
+
<input type="checkbox" id="node-config-input-tls" style="display: inline-block; width: auto; vertical-align: top;" />
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<div class="form-row">
|
|
60
|
+
<label for="node-config-input-user"><i class="fa fa-user"></i> User</label>
|
|
61
|
+
<input type="text" id="node-config-input-user" placeholder="IMAP_USER" />
|
|
62
|
+
<input type="hidden" id="node-config-input-userType" />
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<div class="form-row">
|
|
66
|
+
<label for="node-config-input-password"><i class="fa fa-key"></i> Password</label>
|
|
67
|
+
<input type="text" id="node-config-input-password" placeholder="IMAP_PASSWORD" />
|
|
68
|
+
<input type="hidden" id="node-config-input-passwordType" />
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<div class="form-row">
|
|
72
|
+
<label for="node-config-input-connTimeout"><i class="fa fa-clock-o"></i> Connection Timeout (ms)</label>
|
|
73
|
+
<input type="text" id="node-config-input-connTimeout" placeholder="10000" />
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<div class="form-row">
|
|
77
|
+
<label for="node-config-input-authTimeout"><i class="fa fa-clock-o"></i> Auth Timeout (ms)</label>
|
|
78
|
+
<input type="text" id="node-config-input-authTimeout" placeholder="5000" />
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<div class="form-row">
|
|
82
|
+
<label for="node-config-input-keepalive"><i class="fa fa-heart"></i> Keep Alive</label>
|
|
83
|
+
<input type="checkbox" id="node-config-input-keepalive" style="display: inline-block; width: auto; vertical-align: top;" />
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
<div class="form-row">
|
|
87
|
+
<label for="node-config-input-autotls"><i class="fa fa-shield"></i> Auto TLS</label>
|
|
88
|
+
<select id="node-config-input-autotls" style="width: 70%;">
|
|
89
|
+
<option value="never">Never</option>
|
|
90
|
+
<option value="always">Always</option>
|
|
91
|
+
<option value="required">Required</option>
|
|
92
|
+
</select>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<div class="form-row">
|
|
96
|
+
<label for="node-config-input-rejectUnauthorized"><i class="fa fa-certificate"></i> Reject Unauthorized</label>
|
|
97
|
+
<input type="checkbox" id="node-config-input-rejectUnauthorized" style="display: inline-block; width: auto; vertical-align: top;" />
|
|
98
|
+
</div>
|
|
99
|
+
</script>
|
|
100
|
+
|
|
101
|
+
<script type="text/html" data-help-name="imap-config">
|
|
102
|
+
<p>Configuration node for IMAP server connection settings.</p>
|
|
103
|
+
|
|
104
|
+
<h3>Configuration</h3>
|
|
105
|
+
<dl class="message-properties">
|
|
106
|
+
<dt>Name <span class="property-type">string</span></dt>
|
|
107
|
+
<dd>A friendly name for this IMAP configuration.</dd>
|
|
108
|
+
|
|
109
|
+
<dt>IMAP Host <span class="property-type">string</span></dt>
|
|
110
|
+
<dd>The hostname or IP address of the IMAP server (e.g., imap.gmail.com).</dd>
|
|
111
|
+
|
|
112
|
+
<dt>Port <span class="property-type">number</span></dt>
|
|
113
|
+
<dd>The port number for IMAP connection (typically 993 for TLS, 143 for non-TLS).</dd>
|
|
114
|
+
|
|
115
|
+
<dt>Use TLS <span class="property-type">boolean</span></dt>
|
|
116
|
+
<dd>Enable TLS/SSL encryption for the connection.</dd>
|
|
117
|
+
|
|
118
|
+
<dt>User <span class="property-type">string</span></dt>
|
|
119
|
+
<dd>The username for IMAP authentication.</dd>
|
|
120
|
+
|
|
121
|
+
<dt>Password <span class="property-type">string</span></dt>
|
|
122
|
+
<dd>The password for IMAP authentication. This is stored securely as a credential.</dd>
|
|
123
|
+
|
|
124
|
+
<dt>Connection Timeout <span class="property-type">number</span></dt>
|
|
125
|
+
<dd>The connection timeout in milliseconds (default: 10000).</dd>
|
|
126
|
+
|
|
127
|
+
<dt>Auth Timeout <span class="property-type">number</span></dt>
|
|
128
|
+
<dd>The authentication timeout in milliseconds (default: 5000).</dd>
|
|
129
|
+
|
|
130
|
+
<dt>Keep Alive <span class="property-type">boolean</span></dt>
|
|
131
|
+
<dd>Send periodic NOOP commands to keep the connection alive (default: true).</dd>
|
|
132
|
+
|
|
133
|
+
<dt>Auto TLS <span class="property-type">string</span></dt>
|
|
134
|
+
<dd>Controls STARTTLS behavior: never, always, or required (default: never).</dd>
|
|
135
|
+
|
|
136
|
+
<dt>Reject Unauthorized <span class="property-type">boolean</span></dt>
|
|
137
|
+
<dd>Reject connections with invalid TLS certificates (default: false).</dd>
|
|
138
|
+
</dl>
|
|
139
|
+
</script>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const ImapConfigNode = (RED) => {
|
|
3
|
+
function ImapConfig(config) {
|
|
4
|
+
RED.nodes.createNode(this, config);
|
|
5
|
+
// Store configuration properties
|
|
6
|
+
this.host = config.host;
|
|
7
|
+
this.port = config.port;
|
|
8
|
+
this.tls = config.tls;
|
|
9
|
+
this.user = config.user;
|
|
10
|
+
this.userType = config.userType;
|
|
11
|
+
this.password = config.password;
|
|
12
|
+
this.passwordType = config.passwordType;
|
|
13
|
+
this.connTimeout = config.connTimeout || 10000;
|
|
14
|
+
this.authTimeout = config.authTimeout || 5000;
|
|
15
|
+
this.keepalive = config.keepalive !== undefined ? config.keepalive : true;
|
|
16
|
+
this.autotls = config.autotls || 'never';
|
|
17
|
+
this.rejectUnauthorized = config.rejectUnauthorized !== undefined ? config.rejectUnauthorized : false;
|
|
18
|
+
}
|
|
19
|
+
RED.nodes.registerType('imap-config', ImapConfig);
|
|
20
|
+
};
|
|
21
|
+
module.exports = ImapConfigNode;
|
|
22
|
+
//# sourceMappingURL=imap-config.js.map
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,iBAAS,cAAc,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
// Importiere die Registrierungsfunktion für deine Nodes.
|
|
6
|
+
const imap_config_1 = __importDefault(require("./imap-config/imap-config"));
|
|
7
|
+
const email_receiver_1 = __importDefault(require("./email-receiver/email-receiver"));
|
|
8
|
+
const email_sender_1 = __importDefault(require("./email-sender/email-sender"));
|
|
9
|
+
const html_to_text_1 = __importDefault(require("./html-to-text/html-to-text"));
|
|
10
|
+
module.exports = function (RED) {
|
|
11
|
+
// Rufe die Registrierungsfunktionen für jede Node auf.
|
|
12
|
+
(0, imap_config_1.default)(RED);
|
|
13
|
+
(0, email_receiver_1.default)(RED);
|
|
14
|
+
(0, email_sender_1.default)(RED);
|
|
15
|
+
(0, html_to_text_1.default)(RED);
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,yDAAyD;AACzD,4EAA+D;AAC/D,qFAAwE;AACxE,+EAAkE;AAClE,+EAAiE;AAGjE,iBAAS,UAAU,GAAQ;IACvB,uDAAuD;IACvD,IAAA,qBAAsB,EAAC,GAAG,CAAC,CAAC;IAC5B,IAAA,wBAAyB,EAAC,GAAG,CAAC,CAAC;IAC/B,IAAA,sBAAuB,EAAC,GAAG,CAAC,CAAC;IAC7B,IAAA,sBAAsB,EAAC,GAAG,CAAC,CAAC;AAChC,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ParsedMail } from 'mailparser';
|
|
2
|
+
export interface EmailReceiverMessage {
|
|
3
|
+
topic: string | undefined;
|
|
4
|
+
payload: string | undefined;
|
|
5
|
+
html: string | boolean | undefined;
|
|
6
|
+
from: string | undefined;
|
|
7
|
+
date: Date | undefined;
|
|
8
|
+
folder: string;
|
|
9
|
+
header: ParsedMail['headers'];
|
|
10
|
+
attachments: Array<{
|
|
11
|
+
contentType: string;
|
|
12
|
+
fileName: string | undefined;
|
|
13
|
+
contentDisposition: string;
|
|
14
|
+
generatedFileName: string | undefined;
|
|
15
|
+
contentId: string | undefined;
|
|
16
|
+
checksum: string;
|
|
17
|
+
length: number;
|
|
18
|
+
content: Buffer;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmailReceiverMessage.js","sourceRoot":"","sources":["../../src/interfaces/EmailReceiverMessage.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { NodeDef } from 'node-red';
|
|
2
|
+
export interface EmailSenderNodeProperties extends NodeDef {
|
|
3
|
+
sender: string;
|
|
4
|
+
senderType: string;
|
|
5
|
+
address: string;
|
|
6
|
+
addressType: string;
|
|
7
|
+
to: string;
|
|
8
|
+
toType: string;
|
|
9
|
+
cc: string;
|
|
10
|
+
ccType: string;
|
|
11
|
+
bcc: string;
|
|
12
|
+
bccType: string;
|
|
13
|
+
replyTo: string;
|
|
14
|
+
replyToType: string;
|
|
15
|
+
subject: string;
|
|
16
|
+
subjectType: string;
|
|
17
|
+
htmlContent: string;
|
|
18
|
+
htmlContentType: string;
|
|
19
|
+
attachments: string;
|
|
20
|
+
attachmentsType: string;
|
|
21
|
+
host: string;
|
|
22
|
+
hostType: string;
|
|
23
|
+
port: string;
|
|
24
|
+
portType: string;
|
|
25
|
+
user: string;
|
|
26
|
+
userType: string;
|
|
27
|
+
password: string;
|
|
28
|
+
passwordType: string;
|
|
29
|
+
secure: string;
|
|
30
|
+
secureType: string;
|
|
31
|
+
rejectUnauthorized: string;
|
|
32
|
+
rejectUnauthorizedType: string;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmailSenderNodeProperties.js","sourceRoot":"","sources":["../../src/interfaces/EmailSenderNodeProperties.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchState.js","sourceRoot":"","sources":["../../src/interfaces/FetchState.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ImapConnectionConfig {
|
|
2
|
+
host: string;
|
|
3
|
+
port: number;
|
|
4
|
+
tls: boolean;
|
|
5
|
+
user: string;
|
|
6
|
+
password: string;
|
|
7
|
+
folders: string[];
|
|
8
|
+
markSeen: boolean;
|
|
9
|
+
connTimeout: number;
|
|
10
|
+
authTimeout: number;
|
|
11
|
+
keepalive: boolean;
|
|
12
|
+
autotls: string;
|
|
13
|
+
tlsOptions: {
|
|
14
|
+
rejectUnauthorized: boolean;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImapConnectionConfig.js","sourceRoot":"","sources":["../../src/interfaces/ImapConnectionConfig.ts"],"names":[],"mappings":""}
|