@hyperbytes/wappler-imap-manager 1.1.3 → 1.1.5
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/CHANGELOG.md +1 -0
- package/LICENSE.md +2 -2
- package/package.json +9 -6
- package/scripts/copyFiles.js +1 -2
- package/server_connect/modules/imapcount.js +1 -5
- package/server_connect/modules/imapcreatefolder.js +0 -4
- package/server_connect/modules/imapdelete.js +1 -5
- package/server_connect/modules/imapdeletefolder.js +0 -4
- package/server_connect/modules/imapdirlist.js +1 -5
- package/server_connect/modules/imapexpunge.js +1 -5
- package/server_connect/modules/imapflag.js +1 -6
- package/server_connect/modules/imapgetattachments.js +3 -7
- package/server_connect/modules/imapgetrawheaders.js +0 -4
- package/server_connect/modules/imapgetuidvalidity.js +1 -5
- package/server_connect/modules/imapmailcontent.js +1 -5
- package/server_connect/modules/imapmailheaders.hjson +26 -34
- package/server_connect/modules/imapmailheaders.js +0 -4
- package/server_connect/modules/imapmovefolder.js +1 -5
- package/server_connect/modules/imapremoveflag.js +1 -5
- package/server_connect/modules/imapsaveasdraft.js +1 -3
- package/server_connect/modules/imapsendmail.js +0 -4
- package/server_connect/modules/imapstore.js +1 -5
- package/server_connect/modules/imapsubscribe.js +1 -5
- package/server_connect/modules/imapsubscribedlist.js +1 -5
- package/server_connect/modules/imaptrashperms.js +1 -5
- package/server_connect/modules/imapunsubscribedlist.js +1 -5
package/CHANGELOG.md
CHANGED
package/LICENSE.md
CHANGED
|
@@ -5,10 +5,10 @@ Copyright (c) 2025 Brian English
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
7
7
|
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense,
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
9
|
copies of the Software, and to permit persons to whom the Software is
|
|
10
10
|
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
The above copyright notice and this permission notice shall be included in all
|
|
13
13
|
copies or substantial portions of the Software.
|
|
14
14
|
|
package/package.json
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperbytes/wappler-imap-manager",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "IMAP eMail Management for Wappler",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "MIT",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Brian English - @hyperbytes"
|
|
8
8
|
},
|
|
9
9
|
"keywords": [
|
|
10
10
|
"wappler-extension",
|
|
11
|
+
"server-connect",
|
|
11
12
|
"IMAP",
|
|
12
|
-
"email"
|
|
13
|
+
"email",
|
|
14
|
+
"wappler",
|
|
15
|
+
"node"
|
|
13
16
|
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"postinstall": "node scripts/copyFiles.js"
|
|
19
|
+
},
|
|
14
20
|
"dependencies": {
|
|
15
21
|
"imap": "^0.8.0",
|
|
16
22
|
"mailparser": "^3.7.2",
|
|
@@ -19,8 +25,5 @@
|
|
|
19
25
|
"mailcomposer": "^1.0.0",
|
|
20
26
|
"mime-types": "^3.0.1",
|
|
21
27
|
"mime-db": "^1.54.0"
|
|
22
|
-
},
|
|
23
|
-
"scripts": {
|
|
24
|
-
"postinstall": "node scripts/copyFiles.js"
|
|
25
28
|
}
|
|
26
29
|
}
|
package/scripts/copyFiles.js
CHANGED
|
@@ -3,8 +3,7 @@ const path = require('path');
|
|
|
3
3
|
// Define Source and Destination Directories
|
|
4
4
|
const srcDir = path.join(__dirname, '../server_connect');
|
|
5
5
|
const destDir = path.join(__dirname, '../../../../extensions/server_connect');
|
|
6
|
-
|
|
7
|
-
console.log(`Resolved destination: ${destDir}`);
|
|
6
|
+
|
|
8
7
|
// Get All Subdirectories in Source
|
|
9
8
|
const subDirs = fs.readdirSync(srcDir, { withFileTypes: true })
|
|
10
9
|
.filter(dirent => dirent.isDirectory())
|
|
@@ -46,11 +46,7 @@ exports.imapcount = async function (options, name) {
|
|
|
46
46
|
password: IMAP_PASSWORD,
|
|
47
47
|
host: IMAP_HOST,
|
|
48
48
|
port: IMAP_PORT,
|
|
49
|
-
tls: IMAP_TLS
|
|
50
|
-
tlsOptions: {
|
|
51
|
-
rejectUnauthorized: process.env.IMAP_CERTIFICATE_OVERRIDE === '1' ? false : true
|
|
52
|
-
}
|
|
53
|
-
|
|
49
|
+
tls: IMAP_TLS
|
|
54
50
|
};
|
|
55
51
|
|
|
56
52
|
return getEmailCount(config, mailbox);
|
|
@@ -66,11 +66,7 @@ exports.imapdelete = async function (options, name) {
|
|
|
66
66
|
password: IMAP_PASSWORD,
|
|
67
67
|
host: IMAP_HOST,
|
|
68
68
|
port: IMAP_PORT,
|
|
69
|
-
tls: IMAP_TLS
|
|
70
|
-
tlsOptions: {
|
|
71
|
-
rejectUnauthorized: process.env.IMAP_CERTIFICATE_OVERRIDE === '1' ? false : true
|
|
72
|
-
}
|
|
73
|
-
|
|
69
|
+
tls: IMAP_TLS
|
|
74
70
|
};
|
|
75
71
|
|
|
76
72
|
return deleteEmail(config, uid, uidvalidity);
|
|
@@ -15,11 +15,7 @@ exports.imapdirlist = async function (options) {
|
|
|
15
15
|
password: IMAP_PASSWORD,
|
|
16
16
|
host: IMAP_HOST,
|
|
17
17
|
port: IMAP_PORT,
|
|
18
|
-
tls: IMAP_TLS
|
|
19
|
-
tlsOptions: {
|
|
20
|
-
rejectUnauthorized: process.env.IMAP_CERTIFICATE_OVERRIDE === '1' ? false : true
|
|
21
|
-
}
|
|
22
|
-
|
|
18
|
+
tls: IMAP_TLS
|
|
23
19
|
});
|
|
24
20
|
|
|
25
21
|
imap.once('ready', () => {
|
|
@@ -54,11 +54,7 @@ exports.imapexpunge = async function (options, name) {
|
|
|
54
54
|
password: IMAP_PASSWORD,
|
|
55
55
|
host: IMAP_HOST,
|
|
56
56
|
port: IMAP_PORT,
|
|
57
|
-
tls: IMAP_TLS
|
|
58
|
-
tlsOptions: {
|
|
59
|
-
rejectUnauthorized: process.env.IMAP_CERTIFICATE_OVERRIDE === '1' ? false : true
|
|
60
|
-
}
|
|
61
|
-
|
|
57
|
+
tls: IMAP_TLS
|
|
62
58
|
};
|
|
63
59
|
|
|
64
60
|
return expungeEmail(config);
|
|
@@ -67,14 +67,9 @@ exports.imapflag = async function (options, name) {
|
|
|
67
67
|
password: IMAP_PASSWORD,
|
|
68
68
|
host: IMAP_HOST,
|
|
69
69
|
port: IMAP_PORT,
|
|
70
|
-
tls: IMAP_TLS
|
|
71
|
-
tlsOptions: {
|
|
72
|
-
rejectUnauthorized: process.env.IMAP_CERTIFICATE_OVERRIDE === '1' ? false : true
|
|
73
|
-
}
|
|
74
|
-
|
|
70
|
+
tls: IMAP_TLS
|
|
75
71
|
};
|
|
76
72
|
|
|
77
|
-
|
|
78
73
|
return flagEmail(config, uid, mailbox, uidvalidity);
|
|
79
74
|
};
|
|
80
75
|
|
|
@@ -31,11 +31,7 @@ exports.imapgetattachments = async function (options, name) {
|
|
|
31
31
|
password: IMAP_PASSWORD,
|
|
32
32
|
host: IMAP_HOST,
|
|
33
33
|
port: IMAP_PORT,
|
|
34
|
-
tls: true
|
|
35
|
-
tlsOptions: {
|
|
36
|
-
rejectUnauthorized: process.env.IMAP_CERTIFICATE_OVERRIDE === '1' ? false : true
|
|
37
|
-
}
|
|
38
|
-
|
|
34
|
+
tls: true
|
|
39
35
|
});
|
|
40
36
|
|
|
41
37
|
imap.once('ready', () => {
|
|
@@ -48,7 +44,7 @@ exports.imapgetattachments = async function (options, name) {
|
|
|
48
44
|
// Validate UIDVALIDITY before proceeding
|
|
49
45
|
if (Number(box.uidvalidity) !== Number(uidvalidity)) {
|
|
50
46
|
imap.end();
|
|
51
|
-
return resolve({ savedFiles: [], message: "UID Validity mismatch", url: '', path: '', status:
|
|
47
|
+
return resolve({ savedFiles: [], message: "UID Validity mismatch", url: '', path: '', status: 401 });
|
|
52
48
|
}
|
|
53
49
|
|
|
54
50
|
const fetch = imap.fetch(uid, { bodies: '', struct: true });
|
|
@@ -64,7 +60,7 @@ exports.imapgetattachments = async function (options, name) {
|
|
|
64
60
|
|
|
65
61
|
if (!parsed.attachments || parsed.attachments.length === 0) {
|
|
66
62
|
imap.end();
|
|
67
|
-
return resolve(
|
|
63
|
+
return resolve({ savedFiles: [], message: "No Attachments Found", url: returnPath, path: sentPath, status: 200 });
|
|
68
64
|
}
|
|
69
65
|
|
|
70
66
|
const savedFiles = [];
|
|
@@ -20,10 +20,6 @@ exports.imapgetrawheaders = async function (options) {
|
|
|
20
20
|
host: IMAP_HOST,
|
|
21
21
|
port: IMAP_PORT,
|
|
22
22
|
tls: IMAP_TLS,
|
|
23
|
-
tlsOptions: {
|
|
24
|
-
rejectUnauthorized: process.env.IMAP_CERTIFICATE_OVERRIDE === '1' ? false : true
|
|
25
|
-
}
|
|
26
|
-
|
|
27
23
|
});
|
|
28
24
|
|
|
29
25
|
imap.once('error', (err) => {
|
|
@@ -14,11 +14,7 @@ exports.imapgetuidvalidity = async function (options, name) {
|
|
|
14
14
|
password: IMAP_PASSWORD,
|
|
15
15
|
host: IMAP_HOST,
|
|
16
16
|
port: IMAP_PORT,
|
|
17
|
-
tls: IMAP_TLS
|
|
18
|
-
tlsOptions: {
|
|
19
|
-
rejectUnauthorized: process.env.IMAP_CERTIFICATE_OVERRIDE === '1' ? false : true
|
|
20
|
-
}
|
|
21
|
-
|
|
17
|
+
tls: IMAP_TLS
|
|
22
18
|
});
|
|
23
19
|
|
|
24
20
|
imap.once('ready', () => {
|
|
@@ -18,11 +18,7 @@ exports.imapmailcontent = async function (options, name) {
|
|
|
18
18
|
password: IMAP_PASSWORD,
|
|
19
19
|
host: IMAP_HOST,
|
|
20
20
|
port: IMAP_PORT,
|
|
21
|
-
tls: true
|
|
22
|
-
tlsOptions: {
|
|
23
|
-
rejectUnauthorized: process.env.IMAP_CERTIFICATE_OVERRIDE === '1' ? false : true
|
|
24
|
-
}
|
|
25
|
-
|
|
21
|
+
tls: true
|
|
26
22
|
};
|
|
27
23
|
|
|
28
24
|
const imap = new Imap(imapConfig);
|
|
@@ -13,42 +13,34 @@ groupIcon : 'fas fa-envelope comp-general',
|
|
|
13
13
|
'mailparser' : '^3.7.2'
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
|
-
dataScheme:
|
|
17
|
-
[{ name: 'data', type: 'text', sub:[
|
|
18
|
-
{ name: 'id', type: 'number' }
|
|
19
|
-
{ name: 'uid', type: 'number' }
|
|
16
|
+
dataScheme: [
|
|
20
17
|
{
|
|
21
|
-
name:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
18
|
+
name: "data",
|
|
19
|
+
type: "array",
|
|
20
|
+
sub: [
|
|
21
|
+
{ name: "id", type: "number" },
|
|
22
|
+
{ name: "uid", type: "number" },
|
|
23
|
+
{
|
|
24
|
+
name: "headers",
|
|
25
|
+
type: "object",
|
|
26
|
+
sub: [
|
|
27
|
+
{ name: "from", type: "array" },
|
|
28
|
+
{ name: "to", type: "array" },
|
|
29
|
+
{ name: "cc", type: "array" },
|
|
30
|
+
{ name: "bcc", type: "array" },
|
|
31
|
+
{ name: "subject", type: "array" },
|
|
32
|
+
{ name: "message-id", type: "array" },
|
|
33
|
+
{ name: "messagedate", type: "text" }
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
{ name: "flags", type: "array" },
|
|
37
|
+
{ name: "attachmentCount", type: "number" },
|
|
38
|
+
{ name: "uidvalidity", type: "number" },
|
|
39
|
+
{ name: "mailbox", type: "text" }
|
|
42
40
|
]
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
{ name: 'uidvalidity', type: 'number' }
|
|
47
|
-
{ name: 'mailbox', type: 'text' }
|
|
48
|
-
{ name: 'status', type: 'number' }
|
|
49
|
-
]},
|
|
50
|
-
{ name: 'status', type: 'number' }
|
|
51
|
-
]],
|
|
41
|
+
},
|
|
42
|
+
{ name: "status", type: "number" }
|
|
43
|
+
]
|
|
52
44
|
properties : [
|
|
53
45
|
{
|
|
54
46
|
group: 'IMAP Inputs',
|
|
@@ -19,10 +19,6 @@ exports.imapmailheaders = async function (options, name) {
|
|
|
19
19
|
host: IMAP_HOST,
|
|
20
20
|
port: IMAP_PORT,
|
|
21
21
|
tls: IMAP_TLS,
|
|
22
|
-
tlsOptions: {
|
|
23
|
-
rejectUnauthorized: process.env.IMAP_CERTIFICATE_OVERRIDE === '1' ? false : true
|
|
24
|
-
}
|
|
25
|
-
|
|
26
22
|
});
|
|
27
23
|
|
|
28
24
|
const messages = [];
|
|
@@ -19,11 +19,7 @@ exports.imapmovefolder = async function (options) {
|
|
|
19
19
|
password: IMAP_PASSWORD,
|
|
20
20
|
host: IMAP_HOST,
|
|
21
21
|
port: IMAP_PORT,
|
|
22
|
-
tls: IMAP_TLS
|
|
23
|
-
tlsOptions: {
|
|
24
|
-
rejectUnauthorized: process.env.IMAP_CERTIFICATE_OVERRIDE === '1' ? false : true
|
|
25
|
-
}
|
|
26
|
-
|
|
22
|
+
tls: IMAP_TLS
|
|
27
23
|
});
|
|
28
24
|
|
|
29
25
|
imap.once('ready', () => {
|
|
@@ -19,11 +19,7 @@ exports.imapremoveflag = async function (options, name) {
|
|
|
19
19
|
password: IMAP_PASSWORD,
|
|
20
20
|
host: IMAP_HOST,
|
|
21
21
|
port: IMAP_PORT,
|
|
22
|
-
tls: IMAP_TLS
|
|
23
|
-
tlsOptions: {
|
|
24
|
-
rejectUnauthorized: process.env.IMAP_CERTIFICATE_OVERRIDE === '1' ? false : true
|
|
25
|
-
}
|
|
26
|
-
|
|
22
|
+
tls: IMAP_TLS
|
|
27
23
|
};
|
|
28
24
|
|
|
29
25
|
const removeFlagFromEmail = (uid, flagName, mailboxName, expectedUidValidity) => {
|
|
@@ -71,9 +71,7 @@ exports.imapsaveasdraft = async function (options) {
|
|
|
71
71
|
host: IMAP_HOST,
|
|
72
72
|
port: IMAP_PORT,
|
|
73
73
|
tls: IMAP_TLS,
|
|
74
|
-
tlsOptions: {
|
|
75
|
-
rejectUnauthorized: process.env.IMAP_CERTIFICATE_OVERRIDE === '1' ? false : true
|
|
76
|
-
},
|
|
74
|
+
tlsOptions: { rejectUnauthorized: false },
|
|
77
75
|
authTimeout: 5000
|
|
78
76
|
}
|
|
79
77
|
};
|
|
@@ -114,10 +114,6 @@ async function saveToSentFolder(options, mailOptions) {
|
|
|
114
114
|
host: process.env.IMAP_HOST,
|
|
115
115
|
port: process.env.IMAP_PORT,
|
|
116
116
|
tls: true,
|
|
117
|
-
tlsOptions: {
|
|
118
|
-
rejectUnauthorized: process.env.IMAP_CERTIFICATE_OVERRIDE === '1' ? false : true
|
|
119
|
-
}
|
|
120
|
-
|
|
121
117
|
};
|
|
122
118
|
|
|
123
119
|
let emailContent = `From: ${mailOptions.from}
|
|
@@ -8,11 +8,7 @@ exports.imapgetrawheaders = async function (options) {
|
|
|
8
8
|
password: options.imap_password,
|
|
9
9
|
host: options.imap_host,
|
|
10
10
|
port: options.imap_port,
|
|
11
|
-
tls: true
|
|
12
|
-
tlsOptions: {
|
|
13
|
-
rejectUnauthorized: process.env.IMAP_CERTIFICATE_OVERRIDE === '1' ? false : true
|
|
14
|
-
}
|
|
15
|
-
|
|
11
|
+
tls: true
|
|
16
12
|
});
|
|
17
13
|
|
|
18
14
|
imap.once('ready', () => {
|
|
@@ -15,11 +15,7 @@ exports.imapsubscribe = async function (options) {
|
|
|
15
15
|
password: IMAP_PASSWORD,
|
|
16
16
|
host: IMAP_HOST,
|
|
17
17
|
port: IMAP_PORT,
|
|
18
|
-
tls: IMAP_TLS
|
|
19
|
-
tlsOptions: {
|
|
20
|
-
rejectUnauthorized: process.env.IMAP_CERTIFICATE_OVERRIDE === '1' ? false : true
|
|
21
|
-
}
|
|
22
|
-
|
|
18
|
+
tls: IMAP_TLS
|
|
23
19
|
});
|
|
24
20
|
|
|
25
21
|
imap.once('ready', () => {
|
|
@@ -14,11 +14,7 @@ exports.imapsubscribedlist = async function (options) {
|
|
|
14
14
|
password: IMAP_PASSWORD,
|
|
15
15
|
host: IMAP_HOST,
|
|
16
16
|
port: IMAP_PORT,
|
|
17
|
-
tls: IMAP_TLS
|
|
18
|
-
tlsOptions: {
|
|
19
|
-
rejectUnauthorized: process.env.IMAP_CERTIFICATE_OVERRIDE === '1' ? false : true
|
|
20
|
-
}
|
|
21
|
-
|
|
17
|
+
tls: IMAP_TLS
|
|
22
18
|
});
|
|
23
19
|
|
|
24
20
|
imap.once('ready', () => {
|
|
@@ -14,11 +14,7 @@ exports.imaptrashperms = async function () {
|
|
|
14
14
|
password: IMAP_PASSWORD,
|
|
15
15
|
host: IMAP_HOST,
|
|
16
16
|
port: IMAP_PORT,
|
|
17
|
-
tls: IMAP_TLS
|
|
18
|
-
tlsOptions: {
|
|
19
|
-
rejectUnauthorized: process.env.IMAP_CERTIFICATE_OVERRIDE === '1' ? false : true
|
|
20
|
-
}
|
|
21
|
-
|
|
17
|
+
tls: IMAP_TLS
|
|
22
18
|
});
|
|
23
19
|
|
|
24
20
|
imap.once('ready', () => {
|
|
@@ -13,11 +13,7 @@ exports.imapunsubscribedlist = async function (options) {
|
|
|
13
13
|
password: IMAP_PASSWORD,
|
|
14
14
|
host: IMAP_HOST,
|
|
15
15
|
port: IMAP_PORT,
|
|
16
|
-
tls: IMAP_TLS
|
|
17
|
-
tlsOptions: {
|
|
18
|
-
rejectUnauthorized: process.env.IMAP_CERTIFICATE_OVERRIDE === '1' ? false : true
|
|
19
|
-
}
|
|
20
|
-
|
|
16
|
+
tls: IMAP_TLS
|
|
21
17
|
});
|
|
22
18
|
|
|
23
19
|
imap.once('ready', () => {
|