emailengine-app 1.14.3 → 1.14.7
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/README.md +16 -179
- package/bin/emailengine.js +41 -0
- package/entitlements.mac.plist +18 -0
- package/lib/connection.js +16 -14
- package/lib/logger.js +2 -0
- package/lib/lua/z-get-mailbox-id.lua +5 -0
- package/license-report-config.json +3 -0
- package/licenses.txt +37 -0
- package/package.json +19 -13
- package/static/index.html +2 -2
- package/static/licenses.html +50 -0
- package/workers/api.js +21 -0
- package/workers/imap.js +1 -3
- package/workers/submit.js +2 -2
package/README.md
CHANGED
|
@@ -35,6 +35,14 @@ Later, when you want to upgrade, just run the installation command from step 2.
|
|
|
35
35
|
|
|
36
36
|
> **Tip** For human readable logs you can use _pino-pretty_ (`npm install -g pino-pretty`) by piping EmailEngine output to it: `emailengine | pino-pretty`
|
|
37
37
|
|
|
38
|
+
## Version and license
|
|
39
|
+
|
|
40
|
+
Run the following command to see the version and license information both for EmailEngine and for the included modules.
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
$ emailengine license
|
|
44
|
+
```
|
|
45
|
+
|
|
38
46
|
## Demo
|
|
39
47
|
|
|
40
48
|
[](https://www.youtube.com/watch?v=shHZHowVnYw)
|
|
@@ -73,77 +81,9 @@ There is no official [Redis](https://redis.io/) release for Windows but you can
|
|
|
73
81
|
- [Blog posts](https://docs.emailengine.app/tag/email-engine/)
|
|
74
82
|
- For Postman you can import OpenAPI specification [here](https://api.emailengine.app/swagger.json).
|
|
75
83
|
|
|
76
|
-
##
|
|
77
|
-
|
|
78
|
-
#### General settings
|
|
79
|
-
|
|
80
|
-
| Configuration option | CLI argument | ENV value | Default |
|
|
81
|
-
| -------------------- | ------------------------------------ | ----------------------------- | ---------------------------- |
|
|
82
|
-
| IMAP Worker count | `--workers.imap=4` | `EENGINE_WORKERS=4` | `4` |
|
|
83
|
-
| Redis connection URL | `--dbs.redis="url"` | `EENGINE_REDIS="url"` | `"redis://127.0.0.1:6379/8"` |
|
|
84
|
-
| Prepared settings | `--settings='{"JSON"}'` | `EENGINE_SETTINGS='{"JSON"}'` | not set |
|
|
85
|
-
| Encryption secret | `--service.secret="****"` | `EENGINE_SECRET="****"` | not set |
|
|
86
|
-
| Local addresses | `--service.localAddresses="ip1,ip2"` | `EENGINE_ADDRESSES="ip1,ip2"` | default interface |
|
|
87
|
-
| Max command duration | `--service.commandTimeout=10s` | `EENGINE_TIMEOUT=10s` | `10s` |
|
|
88
|
-
| Log level | `--log.level="level"` | `EENGINE_LOG_LEVEL=level` | `"trace"` |
|
|
89
|
-
| Log raw data | `--log.raw=false` | `EENGINE_LOG_RAW=false` | `false` |
|
|
90
|
-
| Webhook Worker count | `--workers.webhooks=1` | `EENGINE_WORKERS_WEBHOOKS=1` | `1` |
|
|
91
|
-
|
|
92
|
-
#### API server settings
|
|
93
|
-
|
|
94
|
-
| Configuration option | CLI argument | ENV value | Default |
|
|
95
|
-
| -------------------- | ------------------------ | -------------------------- | ------------- |
|
|
96
|
-
| Host to bind to | `--api.host="1.2.3.4"` | `EENGINE_HOST="1.2.3.4"` | `"127.0.0.1"` |
|
|
97
|
-
| Port to bind to | `--api.port=port` | `EENGINE_PORT=port` | `3000` |
|
|
98
|
-
| Max attachment size | `--api.maxSize=5M` | `EENGINE_MAX_SIZE=5M` | `5M` |
|
|
99
|
-
| API Basic Auth | `--api.auth="user:pass"` | `EENGINE_AUTH="user:pass"` | not set |
|
|
100
|
-
|
|
101
|
-
#### SMTP server settings
|
|
102
|
-
|
|
103
|
-
> SMTP server is disabled by default
|
|
104
|
-
|
|
105
|
-
When authenticating via SMTP use the account Id as the username and SMTP password as the password to send emails using the selected account.
|
|
106
|
-
|
|
107
|
-
| Configuration option | CLI argument | ENV value | Default |
|
|
108
|
-
| -------------------- | ----------------------- | ----------------------------- | ------------- |
|
|
109
|
-
| SMTP enabled | `--smtp.enabled=true` | `EENGINE_SMTP_ENABLED=true` | `false` |
|
|
110
|
-
| SMTP password | `--smtp.secret=pass` | `EENGINE_SMTP_SECRET=pass` | `""` |
|
|
111
|
-
| Host to bind to | `--smtp.host="1.2.3.4"` | `EENGINE_SMTP_HOST="1.2.3.4"` | `"127.0.0.1"` |
|
|
112
|
-
| Port to bind to | `--smtp.port=port` | `EENGINE_SMTP_PORT=port` | `2525` |
|
|
113
|
-
| Behind HAProxy | `--smtp.proxy=true` | `EENGINE_SMTP_PROXY=true` | `false` |
|
|
114
|
-
|
|
115
|
-
When sending emails via SMTP you can use the following headers
|
|
116
|
-
|
|
117
|
-
- **X-EE-Send-At: timestamp** to schedule sending to a future time. This matches `sendAt` property of the [POST /submit](https://api.emailengine.app/#operation/postV1AccountAccountSubmit) API endpoint.
|
|
118
|
-
|
|
119
|
-
#### Bull Arena settings
|
|
120
|
-
|
|
121
|
-
[Arena](https://github.com/bee-queue/arena) is a web based UI for Bull.js (the queue system EmailEngine internally uses)
|
|
122
|
-
|
|
123
|
-
> Arena server is disabled by default
|
|
124
|
-
|
|
125
|
-
| Configuration option | CLI argument | ENV value | Default |
|
|
126
|
-
| -------------------- | ------------------------ | ------------------------------ | ------------- |
|
|
127
|
-
| Arena enabled | `--arena.enabled=true` | `EENGINE_ARENA_ENABLED=true` | `false` |
|
|
128
|
-
| Host to bind to | `--arena.host="1.2.3.4"` | `EENGINE_ARENA_HOST="1.2.3.4"` | `"127.0.0.1"` |
|
|
129
|
-
| Port to bind to | `--arena.port=port` | `EENGINE_ARENA_PORT=port` | `3001` |
|
|
130
|
-
|
|
131
|
-
#### Queue settings
|
|
132
|
-
|
|
133
|
-
By default a queue worker process processes a single job at a time. If your queues are processed too slowly you can increase the concurrency counters. Downside is that events aren't processed in correct order anymore, so increase these values only when you do not care about ordering too much.
|
|
84
|
+
## Configuring EmailEngine
|
|
134
85
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
| Configuration option | CLI argument | ENV value | Default |
|
|
138
|
-
| -------------------------- | ------------------- | --------------------- | ------- |
|
|
139
|
-
| Webhooks concurrency count | `--queues.notify=1` | `EENGINE_NOTIFY_QC=1` | `1` |
|
|
140
|
-
| Submit concurrency count | `--queues.submit=1` | `EENGINE_SUBMIT_QC=1` | `1` |
|
|
141
|
-
|
|
142
|
-
---
|
|
143
|
-
|
|
144
|
-
> **NB!** environment variables override CLI arguments. CLI arguments override configuration file values.
|
|
145
|
-
|
|
146
|
-
If available then EmailEngine uses dotenv file from current working directory to populate environment variables.
|
|
86
|
+
See the documentation for configuring EmailEngine [here](https://emailengine.app/configuration).
|
|
147
87
|
|
|
148
88
|
#### Redis connection
|
|
149
89
|
|
|
@@ -153,63 +93,15 @@ $ emailengine --dbs.redis="redis://127.0.0.1:6379/8"
|
|
|
153
93
|
|
|
154
94
|
#### Prepared settings
|
|
155
95
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
```
|
|
159
|
-
$ emailengine --settings='{"webhooks": "https://webhook.site/14e88aea-3391-48b2-a4e6-7b617280155d","webhookEvents":["messageNew"]}'
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
When using Docker Compose where environment variables are defined in YAML format, you can use the following environment variable for prepared settings:
|
|
163
|
-
|
|
164
|
-
```yaml
|
|
165
|
-
EENGINE_SETTINGS: >
|
|
166
|
-
{
|
|
167
|
-
"webhooks": "https://webhook.site/f6a00604-7407-4f40-9a8e-ab68a31a3503",
|
|
168
|
-
"webhookEvents": [
|
|
169
|
-
"messageNew", "messageDeleted"
|
|
170
|
-
]
|
|
171
|
-
}
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
If settings object fails validation then the application does not start.
|
|
96
|
+
Read [here](https://emailengine.app/prepared-settings)
|
|
175
97
|
|
|
176
98
|
#### Encryption secret
|
|
177
99
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
See the documentation for encryption [here](https://docs.emailengine.app/enabling-secret-encryption/).
|
|
181
|
-
|
|
182
|
-
> EmailEngine is also able to use [Vault](https://www.vaultproject.io/) to store the encryption secret. See Vault usage docs [here](https://docs.emailengine.app/enabling-secret-encryption/#using-vault)
|
|
100
|
+
Read [here](https://docs.emailengine.app/enabling-secret-encryption/)
|
|
183
101
|
|
|
184
102
|
#### Local addresses
|
|
185
103
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
This is mostly useful if you are making a large amount of connections and might get rate limited by destination server based on your IP address. Using multiple local addresses allows to distribute separate connections between separate IP addresses. An address is selected randomly from the list whenever making a new IMAP connection.
|
|
189
|
-
|
|
190
|
-
```
|
|
191
|
-
$ emailengine --service.localAddresses="192.168.1.176,192.168.1.177,192.168.1.178"
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
If those interfaces aren't actually available then TCP connections will fail, so check the logs.
|
|
195
|
-
|
|
196
|
-
**Local addresses and SMTP**
|
|
197
|
-
|
|
198
|
-
By default when EmailEngine is sending an email to SMTP it uses local hostname in the SMTP greeting. This hostname is resolved by `os.hostname()`. Sometimes hostname is using invalid format (eg. `Servername_local` as undersore is not actually allowed) and depending on the SMTP MSA server it might reject such connection.
|
|
199
|
-
|
|
200
|
-
To overcome you can set the local hostname to use by appending the hostname to the IP address, separated by pipe symbol
|
|
201
|
-
|
|
202
|
-
```
|
|
203
|
-
$ emailengine --service.localAddresses="ip1|hostname1,ip2|hostname2,ip3|hostname3"
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
For example when using AWS you can use the private interface IP but set a public hostname.
|
|
207
|
-
|
|
208
|
-
```
|
|
209
|
-
$ emailengine --service.localAddresses="172.31.1.2|ec2-18-194-1-2.eu-central-1.compute.amazonaws.com"
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
So in general the hostname shoud be whatever the public interface IP (this is what the SMTP MSA server sees) resolves to.
|
|
104
|
+
Read [here](https://emailengine.app/local-addresses)
|
|
213
105
|
|
|
214
106
|
#### Authentication
|
|
215
107
|
|
|
@@ -470,35 +362,11 @@ By default EmailEngine allows connections only from localhost. To change this ei
|
|
|
470
362
|
|
|
471
363
|
### SystemD
|
|
472
364
|
|
|
473
|
-
|
|
365
|
+
Read about running EmailEngine as a SystemD service [here](https://emailengine.app/system-d-service)
|
|
474
366
|
|
|
475
367
|
### Docker
|
|
476
368
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
Pull EmailEngine from Docker Hub
|
|
480
|
-
|
|
481
|
-
```
|
|
482
|
-
$ docker pull andris9/emailengine
|
|
483
|
-
```
|
|
484
|
-
|
|
485
|
-
Run the app and provide connection URL to Redis (this example assumes that Redis is running in host machine):
|
|
486
|
-
|
|
487
|
-
```
|
|
488
|
-
$ docker run -p 3000:3000 --env EENGINE_REDIS="redis://host.docker.internal:6379/7" andris9/emailengine
|
|
489
|
-
```
|
|
490
|
-
|
|
491
|
-
Next open http://127.0.0.1:3000 in your browser.
|
|
492
|
-
|
|
493
|
-
#### Docker compose
|
|
494
|
-
|
|
495
|
-
Clone this repo and in the root folder run the following to start both EmailEngine and Redis containers.
|
|
496
|
-
|
|
497
|
-
```
|
|
498
|
-
$ docker-compose up
|
|
499
|
-
```
|
|
500
|
-
|
|
501
|
-
Next open http://127.0.0.1:3000 in your browser.
|
|
369
|
+
See the documentation for using EmailEngine with Docker [here](https://emailengine.app/docker).
|
|
502
370
|
|
|
503
371
|
## Resolving issues with Redis
|
|
504
372
|
|
|
@@ -519,38 +387,7 @@ There is a Prometheus output available at `/metrics` URL path of the app.
|
|
|
519
387
|
|
|
520
388
|
## Log analysis
|
|
521
389
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
### pino-pretty
|
|
525
|
-
|
|
526
|
-
As the name says [pino-pretty](https://github.com/pinojs/pino-pretty) makes the logs prettier and thus easier to read.
|
|
527
|
-
|
|
528
|
-
```
|
|
529
|
-
$ npm install -g pino-pretty
|
|
530
|
-
$ emailengine | pino-pretty
|
|
531
|
-
```
|
|
532
|
-
|
|
533
|
-
### pino-gelf
|
|
534
|
-
|
|
535
|
-
It is possible to stream all logs directly to Graylog using [pino-gelf](https://github.com/pinojs/pino-gelf).
|
|
536
|
-
|
|
537
|
-
```
|
|
538
|
-
$ npm install -g pino-pretty
|
|
539
|
-
$ emailengine | pino-gelf log -h graylog.server.com
|
|
540
|
-
```
|
|
541
|
-
|
|
542
|
-
### IMAP transactions
|
|
543
|
-
|
|
544
|
-
Sometimes it is important to understand what kind of traffic is exactly exchanged between the client and the server. By default EmailEngine does show IMAP logs but these are logical not actual logs. It means that these log lines are post processed (passwords and long strings are removed) and might appear out of order in some cases.
|
|
545
|
-
|
|
546
|
-
For debugging it might be important to see the actual logs so EmailEngine allows to enable raw logging using either the `EENGINE_LOG_RAW=true` environment variable or `--log.raw=true` argument. This way EmailEngine includes all data read from and written to socket in base64 format. This is quite unreadable for humans but you can use [eerawlog](https://github.com/postalsys/eerawlog) tool to make it readable.
|
|
547
|
-
|
|
548
|
-
```
|
|
549
|
-
$ npm install eerawlog -g
|
|
550
|
-
$ EENGINE_LOG_RAW=true emailengine | eerawlog
|
|
551
|
-
```
|
|
552
|
-
|
|
553
|
-

|
|
390
|
+
Read about logging options [here](https://emailengine.app/logging)
|
|
554
391
|
|
|
555
392
|
## Security and Data compliance
|
|
556
393
|
|
package/bin/emailengine.js
CHANGED
|
@@ -2,12 +2,53 @@
|
|
|
2
2
|
/* eslint global-require: 0 */
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
+
const packageData = require('../package.json');
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
const pathlib = require('path');
|
|
8
|
+
|
|
5
9
|
if (process.argv[2] === 'encrypt') {
|
|
6
10
|
// encrypt account passwords
|
|
7
11
|
require('../encrypt');
|
|
8
12
|
} else if (process.argv[2] === 'scan') {
|
|
9
13
|
// Scan Redis keys
|
|
10
14
|
require('../scan');
|
|
15
|
+
} else if (['version', '-v', '--version'].includes(process.argv[2])) {
|
|
16
|
+
// Show version
|
|
17
|
+
console.log(`EmailEngine v${packageData.version} (${packageData.license})`);
|
|
18
|
+
} else if (['license', '--license'].includes(process.argv[2])) {
|
|
19
|
+
// Display license information
|
|
20
|
+
fs.readFile(pathlib.join(__dirname, '..', 'LICENSE.txt'), (err, license) => {
|
|
21
|
+
if (err) {
|
|
22
|
+
console.error('Failed to load license information');
|
|
23
|
+
console.error(err);
|
|
24
|
+
return process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
console.error('EmailEngine License');
|
|
28
|
+
console.error('===================');
|
|
29
|
+
console.log(`EmailEngine v${packageData.version}`);
|
|
30
|
+
console.error(`(c) 2020-2021 Postal Systems`);
|
|
31
|
+
console.error(`${packageData.license}, full text follows`);
|
|
32
|
+
console.error('');
|
|
33
|
+
|
|
34
|
+
console.error(license.toString().trim());
|
|
35
|
+
|
|
36
|
+
console.error('');
|
|
37
|
+
|
|
38
|
+
fs.readFile(pathlib.join(__dirname, '..', 'licenses.txt'), (err, data) => {
|
|
39
|
+
if (err) {
|
|
40
|
+
console.error('Failed to load license information');
|
|
41
|
+
console.error(err);
|
|
42
|
+
return process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
console.error('Included Modules');
|
|
46
|
+
console.error('================');
|
|
47
|
+
|
|
48
|
+
console.error(data.toString().trim());
|
|
49
|
+
process.exit();
|
|
50
|
+
});
|
|
51
|
+
});
|
|
11
52
|
} else {
|
|
12
53
|
// run normally
|
|
13
54
|
require('../server');
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>com.apple.security.cs.allow-jit</key>
|
|
6
|
+
<true/>
|
|
7
|
+
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
|
|
8
|
+
<true/>
|
|
9
|
+
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
|
|
10
|
+
<true/>
|
|
11
|
+
<key>com.apple.security.cs.disable-library-validation</key>
|
|
12
|
+
<true/>
|
|
13
|
+
<key>com.apple.security.network.client</key>
|
|
14
|
+
<true/>
|
|
15
|
+
<key>com.apple.security.network.server</key>
|
|
16
|
+
<true/>
|
|
17
|
+
</dict>
|
|
18
|
+
</plist>
|
package/lib/connection.js
CHANGED
|
@@ -593,10 +593,10 @@ class Connection {
|
|
|
593
593
|
await this.notifyQueue.add(event, payload, {
|
|
594
594
|
removeOnComplete: true,
|
|
595
595
|
removeOnFail: true,
|
|
596
|
-
attempts:
|
|
596
|
+
attempts: 10,
|
|
597
597
|
backoff: {
|
|
598
598
|
type: 'exponential',
|
|
599
|
-
delay:
|
|
599
|
+
delay: 5000
|
|
600
600
|
}
|
|
601
601
|
});
|
|
602
602
|
}
|
|
@@ -1343,15 +1343,17 @@ class Connection {
|
|
|
1343
1343
|
smtpConnectionConfig
|
|
1344
1344
|
);
|
|
1345
1345
|
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1346
|
+
if (smtpAuth) {
|
|
1347
|
+
smtpSettings.auth = {
|
|
1348
|
+
user: smtpAuth.user
|
|
1349
|
+
};
|
|
1349
1350
|
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1351
|
+
if (smtpAuth.accessToken) {
|
|
1352
|
+
smtpSettings.auth.type = 'OAuth2';
|
|
1353
|
+
smtpSettings.auth.accessToken = smtpAuth.accessToken;
|
|
1354
|
+
} else {
|
|
1355
|
+
smtpSettings.auth.pass = smtpAuth.pass;
|
|
1356
|
+
}
|
|
1355
1357
|
}
|
|
1356
1358
|
|
|
1357
1359
|
for (let level of ['trace', 'debug', 'info', 'warn', 'error', 'fatal']) {
|
|
@@ -1557,10 +1559,10 @@ class Connection {
|
|
|
1557
1559
|
{
|
|
1558
1560
|
removeOnComplete: true,
|
|
1559
1561
|
removeOnFail: true,
|
|
1560
|
-
attempts:
|
|
1562
|
+
attempts: 10,
|
|
1561
1563
|
backoff: {
|
|
1562
1564
|
type: 'exponential',
|
|
1563
|
-
delay:
|
|
1565
|
+
delay: 5000
|
|
1564
1566
|
},
|
|
1565
1567
|
delay: sendAt.getTime() - now.getTime()
|
|
1566
1568
|
}
|
|
@@ -1572,10 +1574,10 @@ class Connection {
|
|
|
1572
1574
|
{
|
|
1573
1575
|
removeOnComplete: true,
|
|
1574
1576
|
removeOnFail: true,
|
|
1575
|
-
attempts:
|
|
1577
|
+
attempts: 10,
|
|
1576
1578
|
backoff: {
|
|
1577
1579
|
type: 'exponential',
|
|
1578
|
-
delay:
|
|
1580
|
+
delay: 5000
|
|
1579
1581
|
}
|
|
1580
1582
|
}
|
|
1581
1583
|
);
|
package/lib/logger.js
CHANGED
|
@@ -7,6 +7,11 @@ local id = tonumber(redis.call("HGET", hashKey, path)) or 0;
|
|
|
7
7
|
if id == 0 then
|
|
8
8
|
-- ID not yet created
|
|
9
9
|
id = redis.call("HINCRBY", accountKey, 'listRegistry', 1);
|
|
10
|
+
if id == 1 then
|
|
11
|
+
-- first entry on the account, make sure we do not mix with old values (if present)
|
|
12
|
+
redis.call("DEL", hashKey);
|
|
13
|
+
end;
|
|
14
|
+
|
|
10
15
|
redis.call("HSET", hashKey, path, id);
|
|
11
16
|
redis.call("HSET", hashKey, "ix:" .. id, path);
|
|
12
17
|
end;
|
package/licenses.txt
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name license type link installed version author
|
|
2
|
+
---- ------------ ---- ----------------- ------
|
|
3
|
+
@hapi/basic BSD-3-Clause git://github.com/hapijs/basic.git 6.0.0 n/a
|
|
4
|
+
@hapi/boom BSD-3-Clause git://github.com/hapijs/boom.git 9.1.4 n/a
|
|
5
|
+
@hapi/hapi BSD-3-Clause git://github.com/hapijs/hapi.git 20.2.1 n/a
|
|
6
|
+
@hapi/inert BSD-3-Clause git+https://github.com/hapijs/inert.git 6.0.4 n/a
|
|
7
|
+
@hapi/vision BSD-3-Clause git://github.com/hapijs/vision.git 6.1.0 n/a
|
|
8
|
+
bull MIT git://github.com/OptimalBits/bull.git 3.29.2 OptimalBits
|
|
9
|
+
bull-arena MIT git+https://github.com/bee-queue/arena.git 3.29.3 Mixmax
|
|
10
|
+
dotenv BSD-2-Clause git://github.com/motdotla/dotenv.git 10.0.0 n/a
|
|
11
|
+
email-reply-parser MIT https://registry.npmjs.org/email-reply-parser/-/email-reply-parser-1.2.6.tgz 1.2.6 Crisp IM SARL
|
|
12
|
+
exponential-backoff Apache-2.0 git+https://github.com/coveo/exponential-backoff.git 3.1.0 Sami Sayegh
|
|
13
|
+
express MIT git+https://github.com/expressjs/express.git 4.17.1 TJ Holowaychuk
|
|
14
|
+
google-auth-library Apache-2.0 git+https://github.com/googleapis/google-auth-library-nodejs.git 7.10.0 Google Inc.
|
|
15
|
+
hapi-pino MIT git+https://github.com/pinojs/hapi-pino.git 8.5.0 David Mark Clements
|
|
16
|
+
hapi-swagger MIT git://github.com/glennjones/hapi-swagger.git 14.2.4 Glenn Jones
|
|
17
|
+
he MIT git+https://github.com/mathiasbynens/he.git 1.2.0 Mathias Bynens
|
|
18
|
+
html-to-text MIT git://github.com/html-to-text/node-html-to-text.git 8.0.0 Malte Legenhausen
|
|
19
|
+
imapflow MIT git+https://github.com/postalsys/imapflow.git 1.0.74 Postal Systems OÜ
|
|
20
|
+
ioredis MIT git://github.com/luin/ioredis.git 4.27.11 luin
|
|
21
|
+
joi BSD-3-Clause git://github.com/sideway/joi.git 17.4.2 n/a
|
|
22
|
+
jquery MIT git+https://github.com/jquery/jquery.git 3.6.0 OpenJS Foundation and other contributors
|
|
23
|
+
libmime MIT git://github.com/andris9/libmime.git 5.0.0 Andris Reinman
|
|
24
|
+
linkifyjs MIT git+https://github.com/SoapBox/linkifyjs.git 2.1.9 Hypercontext
|
|
25
|
+
mailparser MIT git+https://github.com/nodemailer/mailparser.git 3.3.3 Andris Reinman
|
|
26
|
+
mailsplit (MIT OR EUPL-1.1+) git+https://github.com/andris9/mailsplit.git 5.2.0 Andris Reinman
|
|
27
|
+
msgpack5 MIT git://github.com/mcollina/msgpack5.git 5.3.2 Matteo collina
|
|
28
|
+
node-fetch MIT git+https://github.com/bitinn/node-fetch.git 2.6.1 David Frank
|
|
29
|
+
node-vault MIT git://github.com/kr1sp1n/node-vault.git 0.9.22 kr1sp1n
|
|
30
|
+
nodemailer MIT git+https://github.com/nodemailer/nodemailer.git 6.7.0 Andris Reinman
|
|
31
|
+
pino MIT git+https://github.com/pinojs/pino.git 6.13.3 Matteo Collina
|
|
32
|
+
prom-client Apache-2.0 git+ssh://git@github.com/siimon/prom-client.git 14.0.0 Simon Nyberg
|
|
33
|
+
punycode MIT git+https://github.com/bestiejs/punycode.js.git 2.1.1 Mathias Bynens
|
|
34
|
+
smtp-server MIT git://github.com/andris9/smtp-server.git 3.9.0 Andris Reinman
|
|
35
|
+
uuid MIT git+https://github.com/uuidjs/uuid.git 8.3.2 n/a
|
|
36
|
+
wild-config MIT git+https://github.com/wildduck-email/wild-config.git 1.5.1 Andris Reinman
|
|
37
|
+
yargs MIT git+https://github.com/yargs/yargs.git 17.2.1 n/a
|
package/package.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "emailengine-app",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.7",
|
|
4
4
|
"description": "Email Sync Engine",
|
|
5
5
|
"main": "server.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "node server.js",
|
|
8
8
|
"test": "grunt",
|
|
9
9
|
"swagger": "./getswagger.sh",
|
|
10
|
-
"build-dist": "pkg package.json"
|
|
10
|
+
"build-dist": "npm run licenses && npm run licenses-text && pkg package.json",
|
|
11
|
+
"licenses": "license-report --only=prod --output=html --config license-report-config.json > static/licenses.html",
|
|
12
|
+
"licenses-text": "license-report --only=prod --output=table --config license-report-config.json > licenses.txt"
|
|
11
13
|
},
|
|
12
14
|
"keywords": [
|
|
13
15
|
"IMAP"
|
|
@@ -28,7 +30,7 @@
|
|
|
28
30
|
"dependencies": {
|
|
29
31
|
"@hapi/basic": "6.0.0",
|
|
30
32
|
"@hapi/boom": "9.1.4",
|
|
31
|
-
"@hapi/hapi": "20.2.
|
|
33
|
+
"@hapi/hapi": "20.2.1",
|
|
32
34
|
"@hapi/inert": "6.0.4",
|
|
33
35
|
"@hapi/vision": "6.1.0",
|
|
34
36
|
"bull": "3.29.2",
|
|
@@ -37,38 +39,40 @@
|
|
|
37
39
|
"email-reply-parser": "1.2.6",
|
|
38
40
|
"exponential-backoff": "3.1.0",
|
|
39
41
|
"express": "4.17.1",
|
|
40
|
-
"google-auth-library": "7.
|
|
41
|
-
"hapi-pino": "8.
|
|
42
|
+
"google-auth-library": "7.10.0",
|
|
43
|
+
"hapi-pino": "8.5.0",
|
|
42
44
|
"hapi-swagger": "14.2.4",
|
|
43
45
|
"he": "1.2.0",
|
|
44
46
|
"html-to-text": "8.0.0",
|
|
45
|
-
"imapflow": "1.0.
|
|
46
|
-
"ioredis": "4.27.
|
|
47
|
+
"imapflow": "1.0.75",
|
|
48
|
+
"ioredis": "4.27.11",
|
|
47
49
|
"joi": "17.4.2",
|
|
48
50
|
"jquery": "3.6.0",
|
|
49
51
|
"libmime": "5.0.0",
|
|
50
52
|
"linkifyjs": "2.1.9",
|
|
51
|
-
"mailparser": "3.3.
|
|
53
|
+
"mailparser": "3.3.3",
|
|
52
54
|
"mailsplit": "5.2.0",
|
|
53
55
|
"msgpack5": "5.3.2",
|
|
54
56
|
"node-fetch": "2.6.1",
|
|
55
57
|
"node-vault": "0.9.22",
|
|
56
|
-
"nodemailer": "6.
|
|
58
|
+
"nodemailer": "6.7.0",
|
|
57
59
|
"pino": "6.13.3",
|
|
58
60
|
"prom-client": "14.0.0",
|
|
59
61
|
"punycode": "2.1.1",
|
|
60
62
|
"smtp-server": "3.9.0",
|
|
61
63
|
"uuid": "8.3.2",
|
|
62
|
-
"wild-config": "1.5.1"
|
|
64
|
+
"wild-config": "1.5.1",
|
|
65
|
+
"yargs": "^17.2.1"
|
|
63
66
|
},
|
|
64
67
|
"devDependencies": {
|
|
65
|
-
"eslint": "
|
|
68
|
+
"eslint": "8.0.0",
|
|
66
69
|
"eslint-config-nodemailer": "1.2.0",
|
|
67
70
|
"eslint-config-prettier": "8.3.0",
|
|
68
71
|
"grunt": "1.4.1",
|
|
69
72
|
"grunt-cli": "1.4.3",
|
|
70
73
|
"grunt-eslint": "23.0.0",
|
|
71
|
-
"
|
|
74
|
+
"license-report": "4.5.0",
|
|
75
|
+
"pkg": "5.3.3"
|
|
72
76
|
},
|
|
73
77
|
"pkg": {
|
|
74
78
|
"scripts": [
|
|
@@ -79,7 +83,9 @@
|
|
|
79
83
|
"views/**/*",
|
|
80
84
|
"lib/lua/**/*",
|
|
81
85
|
"node_modules/bull/lib/commands/**/*",
|
|
82
|
-
"node_modules/swagger-ui-dist/**/*"
|
|
86
|
+
"node_modules/swagger-ui-dist/**/*",
|
|
87
|
+
"licenses.txt",
|
|
88
|
+
"LICENSE.txt"
|
|
83
89
|
],
|
|
84
90
|
"_targets": [
|
|
85
91
|
"node16-macos-x64"
|
package/static/index.html
CHANGED
|
@@ -502,9 +502,9 @@ $ curl -XPOST "<span class="domainName">localhost:3000</span>/v1/account" -H "co
|
|
|
502
502
|
<span class="text-muted">Licensed under </span><span class="text-muted app-license"></span>
|
|
503
503
|
</div>
|
|
504
504
|
</div>
|
|
505
|
-
<div class="row
|
|
505
|
+
<div class="row">
|
|
506
506
|
<div class="col-sm-8 text-muted">
|
|
507
|
-
|
|
507
|
+
License information for Open Source software included in EmailEngine can be seen <a href="/licenses.html">here</a>.
|
|
508
508
|
</div>
|
|
509
509
|
</div>
|
|
510
510
|
</div>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<body>
|
|
3
|
+
<style>
|
|
4
|
+
/*
|
|
5
|
+
based on: https://codepen.io/DavidKern/pen/PwzYvv
|
|
6
|
+
*/
|
|
7
|
+
@import url(https://fonts.googleapis.com/css?family=Lato:300,400,700);
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
body {
|
|
11
|
+
background: #fff;
|
|
12
|
+
color: #000;
|
|
13
|
+
font-family: 'Lato', Arial, sans-serif;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
h1 {
|
|
17
|
+
font-family: "proxima-nova",sans-serif;
|
|
18
|
+
letter-spacing: -0.01em;
|
|
19
|
+
font-weight: 700;
|
|
20
|
+
font-style: normal;
|
|
21
|
+
font-size: 60px;
|
|
22
|
+
margin-left: -3px;
|
|
23
|
+
line-height: 1em;
|
|
24
|
+
color: #000;
|
|
25
|
+
text-align: center;
|
|
26
|
+
margin-bottom: 8px;
|
|
27
|
+
text-rendering: optimizeLegibility;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
table {
|
|
31
|
+
width: 80%;
|
|
32
|
+
margin: auto;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
table, th, td {
|
|
36
|
+
border: 1px solid #000;
|
|
37
|
+
border-collapse: collapse;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
th {
|
|
41
|
+
background-color: #ddd
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
th, td {
|
|
45
|
+
padding: 15px;
|
|
46
|
+
}
|
|
47
|
+
</style>
|
|
48
|
+
<table><thead><tr><th class="undefined">author</th><th class="string">installed version</th><th class="string">link</th><th class="string">license type</th><th class="string">name</th></tr></thead><tbody><tr><td class="undefined"></td><td class="string">6.0.0</td><td class="string">git://github.com/hapijs/basic.git</td><td class="string">BSD-3-Clause</td><td class="string">@hapi/basic</td></tr><tr><td class="undefined"></td><td class="string">9.1.4</td><td class="string">git://github.com/hapijs/boom.git</td><td class="string">BSD-3-Clause</td><td class="string">@hapi/boom</td></tr><tr><td class="undefined"></td><td class="string">20.2.1</td><td class="string">git://github.com/hapijs/hapi.git</td><td class="string">BSD-3-Clause</td><td class="string">@hapi/hapi</td></tr><tr><td class="undefined"></td><td class="string">6.0.4</td><td class="string">git+https://github.com/hapijs/inert.git</td><td class="string">BSD-3-Clause</td><td class="string">@hapi/inert</td></tr><tr><td class="undefined"></td><td class="string">6.1.0</td><td class="string">git://github.com/hapijs/vision.git</td><td class="string">BSD-3-Clause</td><td class="string">@hapi/vision</td></tr><tr><td class="string">OptimalBits</td><td class="string">3.29.2</td><td class="string">git://github.com/OptimalBits/bull.git</td><td class="string">MIT</td><td class="string">bull</td></tr><tr><td class="string">Mixmax</td><td class="string">3.29.3</td><td class="string">git+https://github.com/bee-queue/arena.git</td><td class="string">MIT</td><td class="string">bull-arena</td></tr><tr><td class="undefined"></td><td class="string">10.0.0</td><td class="string">git://github.com/motdotla/dotenv.git</td><td class="string">BSD-2-Clause</td><td class="string">dotenv</td></tr><tr><td class="string">Crisp IM SARL</td><td class="string">1.2.6</td><td class="string">https://registry.npmjs.org/email-reply-parser/-/email-reply-parser-1.2.6.tgz</td><td class="string">MIT</td><td class="string">email-reply-parser</td></tr><tr><td class="string">Sami Sayegh</td><td class="string">3.1.0</td><td class="string">git+https://github.com/coveo/exponential-backoff.git</td><td class="string">Apache-2.0</td><td class="string">exponential-backoff</td></tr><tr><td class="string">TJ Holowaychuk</td><td class="string">4.17.1</td><td class="string">git+https://github.com/expressjs/express.git</td><td class="string">MIT</td><td class="string">express</td></tr><tr><td class="string">Google Inc.</td><td class="string">7.10.0</td><td class="string">git+https://github.com/googleapis/google-auth-library-nodejs.git</td><td class="string">Apache-2.0</td><td class="string">google-auth-library</td></tr><tr><td class="string">David Mark Clements</td><td class="string">8.5.0</td><td class="string">git+https://github.com/pinojs/hapi-pino.git</td><td class="string">MIT</td><td class="string">hapi-pino</td></tr><tr><td class="string">Glenn Jones</td><td class="string">14.2.4</td><td class="string">git://github.com/glennjones/hapi-swagger.git</td><td class="string">MIT</td><td class="string">hapi-swagger</td></tr><tr><td class="string">Mathias Bynens</td><td class="string">1.2.0</td><td class="string">git+https://github.com/mathiasbynens/he.git</td><td class="string">MIT</td><td class="string">he</td></tr><tr><td class="string">Malte Legenhausen</td><td class="string">8.0.0</td><td class="string">git://github.com/html-to-text/node-html-to-text.git</td><td class="string">MIT</td><td class="string">html-to-text</td></tr><tr><td class="string">Postal Systems OÜ</td><td class="string">1.0.74</td><td class="string">git+https://github.com/postalsys/imapflow.git</td><td class="string">MIT</td><td class="string">imapflow</td></tr><tr><td class="string">luin</td><td class="string">4.27.11</td><td class="string">git://github.com/luin/ioredis.git</td><td class="string">MIT</td><td class="string">ioredis</td></tr><tr><td class="undefined"></td><td class="string">17.4.2</td><td class="string">git://github.com/sideway/joi.git</td><td class="string">BSD-3-Clause</td><td class="string">joi</td></tr><tr><td class="string">OpenJS Foundation and other contributors</td><td class="string">3.6.0</td><td class="string">git+https://github.com/jquery/jquery.git</td><td class="string">MIT</td><td class="string">jquery</td></tr><tr><td class="string">Andris Reinman</td><td class="string">5.0.0</td><td class="string">git://github.com/andris9/libmime.git</td><td class="string">MIT</td><td class="string">libmime</td></tr><tr><td class="string">Hypercontext</td><td class="string">2.1.9</td><td class="string">git+https://github.com/SoapBox/linkifyjs.git</td><td class="string">MIT</td><td class="string">linkifyjs</td></tr><tr><td class="string">Andris Reinman</td><td class="string">3.3.3</td><td class="string">git+https://github.com/nodemailer/mailparser.git</td><td class="string">MIT</td><td class="string">mailparser</td></tr><tr><td class="string">Andris Reinman</td><td class="string">5.2.0</td><td class="string">git+https://github.com/andris9/mailsplit.git</td><td class="string">(MIT OR EUPL-1.1+)</td><td class="string">mailsplit</td></tr><tr><td class="string">Matteo collina</td><td class="string">5.3.2</td><td class="string">git://github.com/mcollina/msgpack5.git</td><td class="string">MIT</td><td class="string">msgpack5</td></tr><tr><td class="string">David Frank</td><td class="string">2.6.1</td><td class="string">git+https://github.com/bitinn/node-fetch.git</td><td class="string">MIT</td><td class="string">node-fetch</td></tr><tr><td class="string">kr1sp1n</td><td class="string">0.9.22</td><td class="string">git://github.com/kr1sp1n/node-vault.git</td><td class="string">MIT</td><td class="string">node-vault</td></tr><tr><td class="string">Andris Reinman</td><td class="string">6.7.0</td><td class="string">git+https://github.com/nodemailer/nodemailer.git</td><td class="string">MIT</td><td class="string">nodemailer</td></tr><tr><td class="string">Matteo Collina</td><td class="string">6.13.3</td><td class="string">git+https://github.com/pinojs/pino.git</td><td class="string">MIT</td><td class="string">pino</td></tr><tr><td class="string">Simon Nyberg</td><td class="string">14.0.0</td><td class="string">git+ssh://git@github.com/siimon/prom-client.git</td><td class="string">Apache-2.0</td><td class="string">prom-client</td></tr><tr><td class="string">Mathias Bynens</td><td class="string">2.1.1</td><td class="string">git+https://github.com/bestiejs/punycode.js.git</td><td class="string">MIT</td><td class="string">punycode</td></tr><tr><td class="string">Andris Reinman</td><td class="string">3.9.0</td><td class="string">git://github.com/andris9/smtp-server.git</td><td class="string">MIT</td><td class="string">smtp-server</td></tr><tr><td class="undefined"></td><td class="string">8.3.2</td><td class="string">git+https://github.com/uuidjs/uuid.git</td><td class="string">MIT</td><td class="string">uuid</td></tr><tr><td class="string">Andris Reinman</td><td class="string">1.5.1</td><td class="string">git+https://github.com/wildduck-email/wild-config.git</td><td class="string">MIT</td><td class="string">wild-config</td></tr><tr><td class="undefined"></td><td class="string">17.2.1</td><td class="string">git+https://github.com/yargs/yargs.git</td><td class="string">MIT</td><td class="string">yargs</td></tr></tbody></table>
|
|
49
|
+
</body>
|
|
50
|
+
</html>
|
package/workers/api.js
CHANGED
|
@@ -187,6 +187,18 @@ const init = async () => {
|
|
|
187
187
|
host: process.env.EENGINE_HOST || config.api.host
|
|
188
188
|
});
|
|
189
189
|
|
|
190
|
+
server.ext('onPreHandler', async (request, h) => {
|
|
191
|
+
logger.debug({
|
|
192
|
+
msg: 'request onPreHandler',
|
|
193
|
+
action: 'onPreHandler',
|
|
194
|
+
method: request.method,
|
|
195
|
+
path: request.path,
|
|
196
|
+
account: request.params && request.params.account
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
return h.continue;
|
|
200
|
+
});
|
|
201
|
+
|
|
190
202
|
const swaggerOptions = {
|
|
191
203
|
swaggerUI: true,
|
|
192
204
|
swaggerUIPath: '/swagger/',
|
|
@@ -271,6 +283,14 @@ const init = async () => {
|
|
|
271
283
|
}
|
|
272
284
|
});
|
|
273
285
|
|
|
286
|
+
server.route({
|
|
287
|
+
method: 'GET',
|
|
288
|
+
path: '/licenses.html',
|
|
289
|
+
handler: {
|
|
290
|
+
file: { path: pathlib.join(__dirname, '..', 'static', 'licenses.html'), confine: false }
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
|
|
274
294
|
server.route({
|
|
275
295
|
method: 'GET',
|
|
276
296
|
path: '/static/{file*}',
|
|
@@ -2278,6 +2298,7 @@ async function getStats(seconds) {
|
|
|
2278
2298
|
accounts: await redis.scard('ia:accounts'),
|
|
2279
2299
|
node: process.versions.node,
|
|
2280
2300
|
redis: redisVersion,
|
|
2301
|
+
imapflow: ImapFlow.version || 'please upgrade',
|
|
2281
2302
|
counters
|
|
2282
2303
|
},
|
|
2283
2304
|
structuredMetrics
|
package/workers/imap.js
CHANGED
|
@@ -162,9 +162,7 @@ class ConnectionHandler {
|
|
|
162
162
|
cid: accountObject.connection.cid,
|
|
163
163
|
msg: 'Account reconnect requested'
|
|
164
164
|
});
|
|
165
|
-
await redis.
|
|
166
|
-
state: 'connecting'
|
|
167
|
-
});
|
|
165
|
+
await redis.hset(accountObject.connection.getAccountKey(), 'state', 'connecting');
|
|
168
166
|
await accountObject.connection.reconnect(true);
|
|
169
167
|
}
|
|
170
168
|
}
|
package/workers/submit.js
CHANGED
|
@@ -91,10 +91,10 @@ async function notify(account, event, data) {
|
|
|
91
91
|
await notifyQueue.add(event, payload, {
|
|
92
92
|
removeOnComplete: true,
|
|
93
93
|
removeOnFail: true,
|
|
94
|
-
attempts:
|
|
94
|
+
attempts: 10,
|
|
95
95
|
backoff: {
|
|
96
96
|
type: 'exponential',
|
|
97
|
-
delay:
|
|
97
|
+
delay: 5000
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
}
|