emailengine-app 2.73.0 → 2.73.1

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.
@@ -3,8 +3,7 @@ name: E2E Tests
3
3
  # Browser-driven happy-path end-to-end suite (test/e2e), kept separate from the unit and
4
4
  # integration tiers so it is easy to re-run on its own and has its own requirements: it drives a
5
5
  # real browser (Playwright/Chromium) and reaches external services (Ethereal for the test mailbox,
6
- # postalsys.com for the 14-day trial). The trial rate limit is bypassed for the e2e serviceUrl
7
- # (https://e2e.emailengine.app/) - see the postalsys-web trial allowlist.
6
+ # postalsys.com for the 14-day trial).
8
7
 
9
8
  on:
10
9
  workflow_dispatch:
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.73.1](https://github.com/postalsys/emailengine/compare/v2.73.0...v2.73.1) (2026-07-21)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **imap:** stop the OAuth token renewal reconnect loop that pinned the CPU ([eff5727](https://github.com/postalsys/emailengine/commit/eff5727f4a328326609856861465f524e381689c))
9
+ * restore the scan CLI command and stop packing secrets into the tarball ([edddb4e](https://github.com/postalsys/emailengine/commit/edddb4e70e96a7267880e295f0d9448b16ed214e))
10
+
3
11
  ## [2.73.0](https://github.com/postalsys/emailengine/compare/v2.72.4...v2.73.0) (2026-07-20)
4
12
 
5
13
 
package/Dockerfile CHANGED
@@ -42,7 +42,6 @@ COPY .git/refs/heads/master .git/refs/heads/master
42
42
  COPY update-info.sh update-info.sh
43
43
 
44
44
  RUN npm ci --omit=dev
45
- RUN npm run prepare-docker
46
45
  RUN chmod +x ./update-info.sh
47
46
  RUN ./update-info.sh
48
47
 
package/README.md CHANGED
@@ -16,27 +16,37 @@ A headless email client application that provides access to IMAP, SMTP, Gmail AP
16
16
  - [Monitor INBOX and Junk folders](https://learn.emailengine.app/docs/advanced/inbox-placement-testing) of a test email account to track where sent emails land.
17
17
  - Ideal for lightweight webmail and mobile email apps that prefer to avoid direct IMAP and MIME processing.
18
18
 
19
+ ## Features
20
+
21
+ - **One REST API for every provider.** IMAP/SMTP, the Gmail API, and Microsoft Graph are all exposed through the same endpoints, so your integration does not change when a user switches provider.
22
+ - **Real-time webhooks.** Get notified about new, deleted, and updated messages, sent mail, delivery errors, bounces, and account state changes. Optional [custom routes](https://learn.emailengine.app/docs/webhooks/webhook-routing) filter and reshape payloads per destination.
23
+ - **Sending.** Queued delivery with retries, stored [templates](https://learn.emailengine.app/docs/sending/templates), sending gateways, open and click tracking, unsubscribe handling, a blocklist, and bounce classification.
24
+ - **Account onboarding.** A [hosted authentication form](https://learn.emailengine.app/docs/accounts/hosted-authentication) handles OAuth2 (Google, Microsoft) and IMAP credentials so you never touch the user's password.
25
+ - **Bulk export.** Export an account's mail to compressed NDJSON, optionally encrypted.
26
+ - **Protocol servers for legacy apps.** A built-in SMTP submission server (MSA) and an IMAP proxy let existing clients reach OAuth2-only mailboxes without implementing OAuth2 themselves.
27
+ - **Admin interface.** Server-rendered dashboard with light and dark themes, an embedded API reference, queue inspection, and logs.
28
+ - **Admin authentication.** Password, passkeys (WebAuthn), TOTP two-factor, and SSO through Okta or any OpenID Connect provider (Keycloak, Authentik, Entra ID, Google).
29
+ - **Operations.** Prometheus metrics, structured logging, and a 7-language admin UI.
30
+
19
31
  ## Quickstart
20
32
 
21
33
  - [Setup Instructions](https://learn.emailengine.app/docs/getting-started/quick-start)
22
34
 
23
35
  ## Screenshots
24
36
 
25
- ![Screenshot 1](https://cldup.com/dC_4_suWrh.png)
26
- ![Screenshot 2](https://cldup.com/KibGXRw8Mm.png)
27
- ![Screenshot 3](https://cldup.com/mCxzWWjcLL.png)
28
-
29
- ## Version and License
30
-
31
- Run the following command to check the version and license information for both EmailEngine and its included modules:
32
-
33
- ```bash
34
- $ emailengine license
35
- ```
37
+ ![The EmailEngine dashboard, showing account, activity, and system counters](https://raw.githubusercontent.com/postalsys/emailengine/master/screenshots/dashboard.png)
38
+ ![The accounts list, showing connected email accounts and their sync status](https://raw.githubusercontent.com/postalsys/emailengine/master/screenshots/accounts.png)
39
+ ![The built-in API reference, listing the account endpoints](https://raw.githubusercontent.com/postalsys/emailengine/master/screenshots/api-reference.png)
36
40
 
37
41
  ## Requirements
38
42
 
39
- - **Redis** - Any version
43
+ - **Node.js** - version 20 or newer (only when running from source; the prebuilt binaries and the Docker image bundle their own runtime)
44
+ - **Redis** - any version
45
+
46
+ > [!IMPORTANT]
47
+ > EmailEngine uses Redis as its primary database, not as a cache. Set `maxmemory-policy` to `noeviction` and give Redis enough memory for your workload - with any other policy Redis can drop sync state, which makes already-synced messages look new and generates duplicate webhooks.
48
+ >
49
+ > Redis Cluster and Amazon ElastiCache are **not** supported. Use a standard Redis primary instance. EmailEngine warns about all of the above on the dashboard when it detects them.
40
50
 
41
51
  > [!NOTE]
42
52
  > While Redis does not officially support Windows, alternatives like [Memurai](https://www.memurai.com/) are available.
@@ -48,7 +58,7 @@ $ emailengine license
48
58
 
49
59
  - [Documentation](https://learn.emailengine.app/)
50
60
  - [API Reference](https://learn.emailengine.app/docs/api/emailengine-api)
51
- - OpenAPI specification for Postman: [swagger.json](https://emailengine.dev/swagger.json)
61
+ - OpenAPI specification for Postman and code generators: every instance serves its own at `/swagger.json`, or use the hosted copy at [emailengine.dev/swagger.json](https://emailengine.dev/swagger.json)
52
62
 
53
63
  ## Configuring EmailEngine
54
64
 
@@ -64,19 +74,19 @@ By default, EmailEngine only allows connections from localhost. To enable extern
64
74
 
65
75
  You can use the included install script to set up:
66
76
 
77
+ - Redis as the data store
67
78
  - EmailEngine as a SystemD service
68
79
  - Caddy as a reverse proxy and HTTPS certificate handler
69
80
 
81
+ The script must run as root, and takes the domain name for EmailEngine as its first argument:
82
+
70
83
  ```bash
71
84
  $ wget https://raw.githubusercontent.com/postalsys/emailengine/master/install.sh
72
85
  $ chmod +x install.sh
73
- $ ./install.sh example.com
86
+ $ sudo ./install.sh example.com
74
87
  ```
75
88
 
76
- Where **example.com** is the domain name for EmailEngine.
77
-
78
- > [!NOTE]
79
- > Tested on Ubuntu 20.04 and Debian 11. Other versions may not be supported.
89
+ Pass a version as the optional second argument to install a specific release instead of the latest one. Re-running the script on an existing installation upgrades it in place, and it also installs `/opt/upgrade-emailengine.sh` for later upgrades.
80
90
 
81
91
  ### SystemD
82
92
 
@@ -100,7 +110,25 @@ To execute EmailEngine-CLI commands within a Docker container:
100
110
  $ node bin/emailengine.js <command>
101
111
  ```
102
112
 
103
- For full Docker usage documentation, visit [here](https://learn.emailengine.app/docs/installation/docker).
113
+ For full Docker usage documentation, visit [here](https://learn.emailengine.app/docs/installation/docker). This repository also ships a `docker-compose.yml` and a longer [Docker deployment guide](./DOCKER_DEPLOYMENT.md).
114
+
115
+ ## Command Line Interface
116
+
117
+ Run `emailengine help` for the full list, or `emailengine help <command>` for a single one.
118
+
119
+ | Command | Description |
120
+ | -------------------------- | ---------------------------------------------------- |
121
+ | `emailengine` | Start the EmailEngine server |
122
+ | `emailengine version` | Show the version number |
123
+ | `emailengine license` | Show the EmailEngine version and license terms |
124
+ | `emailengine password` | Set or reset the admin password |
125
+ | `emailengine tokens` | Issue, export, and import API access tokens |
126
+ | `emailengine encrypt` | Manage field-level encryption for stored credentials |
127
+ | `emailengine export` | Export account data, including credentials |
128
+ | `emailengine scan` | Scan the Redis keyspace and output a CSV report |
129
+ | `emailengine check-bounce` | Analyze a bounce email and classify it |
130
+
131
+ The license terms of the bundled third-party modules are not part of `emailengine license` - a running instance serves them at [http://127.0.0.1:3000/licenses.html](http://127.0.0.1:3000/licenses.html).
104
132
 
105
133
  ## Resolving Issues with Redis
106
134
 
@@ -108,7 +136,7 @@ EmailEngine relies on Redis as its data store. Redis stores everything in RAM, s
108
136
 
109
137
  To diagnose problems:
110
138
 
111
- 1. **Check Bull Queues:** Use the built-in Bull Arena UI to monitor queue states at [http://127.0.0.1:3000/admin/bull-board](http://127.0.0.1:3000/admin/bull-board).
139
+ 1. **Check the job queues:** Use the built-in Bull Board UI to monitor queue states at [http://127.0.0.1:3000/admin/bull-board](http://127.0.0.1:3000/admin/bull-board) (requires an admin session).
112
140
  2. **Scan Keyspace:** Run the following to group Redis keys by type and generate a report:
113
141
 
114
142
  ```bash
@@ -117,17 +145,19 @@ To diagnose problems:
117
145
 
118
146
  ## Monitoring
119
147
 
120
- EmailEngine provides Prometheus metrics, available at the `/metrics` URL path.
148
+ EmailEngine provides Prometheus metrics at the `/metrics` URL path. The endpoint requires an access token with the `metrics` or `*` scope:
149
+
150
+ ```bash
151
+ $ curl -H "Authorization: Bearer $EE_TOKEN" http://127.0.0.1:3000/metrics
152
+ ```
121
153
 
122
154
  ## Log Analysis
123
155
 
124
156
  For information on logging options, read the documentation [here](https://learn.emailengine.app/docs/advanced/logging).
125
157
 
126
- To trace IMAP traffic for a specific account, use the following command:
158
+ To trace the IMAP traffic of a single account, open that account in the admin interface and turn on logging for it. EmailEngine then keeps a rolling log for the account, which you can read on the same page or download as a text file.
127
159
 
128
- ```bash
129
- $ npm run raw -- --filter.account=account1
130
- ```
160
+ To log raw IMAP traffic for every account instead, start EmailEngine with `--log.raw=true` (or `EENGINE_LOG_RAW=true`). This is verbose and includes message content, so keep it off in production.
131
161
 
132
162
  ## Security and Data Compliance
133
163
 
package/config/e2e.toml CHANGED
@@ -7,8 +7,8 @@
7
7
  # preparedLicense here on purpose - the suite enables auth and activates the trial through the UI.
8
8
 
9
9
  # JSON formatted settings, seeded on startup.
10
- # serviceUrl is the recognizable e2e URL that postalsys-web allowlists to skip the trial rate
11
- # limit. It is only used as the trial request's `url`; the browser and API talk to 127.0.0.1:7099.
10
+ # serviceUrl identifies this throwaway e2e instance to the trial endpoint. It is only used as the
11
+ # trial request's `url`; the browser and API talk to 127.0.0.1:7099.
12
12
  settings = '''
13
13
  {
14
14
  "serviceUrl": "https://e2e.emailengine.app/",
package/lib/account.js CHANGED
@@ -724,7 +724,11 @@ class Account {
724
724
  return accountData;
725
725
  }
726
726
 
727
- async update(accountData) {
727
+ // `reauthorized` marks an update that carries credentials supplied by an external caller,
728
+ // i.e. possible operator re-authorization. Only the public account-update API route sets it;
729
+ // every unattended writer (token renewal, client initialize(), invalidateAccessToken) leaves
730
+ // it false and can therefore never trigger the reconnect gate below.
731
+ async update(accountData, { reauthorized = false } = {}) {
728
732
  let oldAccountData = await this.loadAccountData(accountData.account);
729
733
 
730
734
  if (accountData.oauth2?.provider) {
@@ -864,13 +868,17 @@ class Account {
864
868
 
865
869
  // When OAuth2 credentials are re-authorized for an account that is currently in a
866
870
  // non-operational error state, trigger a full reconnect so syncing resumes without a
867
- // manual "Reconnect". Gated on the error state and on the credentials actually
868
- // changing, so routine token renewal - which runs while the account is connected and
869
- // re-saves oauth2 hourly - never triggers a reconnect. During an actual reconnect the
870
- // state is set to "connecting" before tokens are fetched, so this cannot loop.
871
+ // manual "Reconnect".
872
+ //
873
+ // Requires explicit `reauthorized` intent from the caller. Account state cannot be used
874
+ // to infer it: unattended token renewal persists through update() as well, and it runs
875
+ // while the stored state is still the error state, so a state-only gate re-fired on every
876
+ // renewal and dispatched cmd:'reconnect'. That rebuilt the client, discarding its backoff,
877
+ // and invalidateAccessToken() forced the next cycle to renew again - latching a reconnect
878
+ // loop that pinned the CPU at ~100%.
871
879
  if (
880
+ reauthorized &&
872
881
  !reconnectRequested &&
873
- 'oauth2' in accountData &&
874
882
  accountData.oauth2?.accessToken &&
875
883
  (accountData.oauth2.accessToken !== oldAccountData.oauth2?.accessToken ||
876
884
  accountData.oauth2.refreshToken !== oldAccountData.oauth2?.refreshToken) &&
@@ -319,7 +319,10 @@ async function init(args) {
319
319
  // Validate delegation fields are only used with OAuth2 provider
320
320
  validateDelegationFields(request.payload);
321
321
 
322
- return await accountObject.update(request.payload);
322
+ // Credentials in this payload came from an API client, so a credential change here
323
+ // can mean the account was re-authorized - the only caller allowed to arm the
324
+ // reconnect gate in update().
325
+ return await accountObject.update(request.payload, { reauthorized: true });
323
326
  } catch (err) {
324
327
  handleError(request, err);
325
328
  }
package/lib/consts.js CHANGED
@@ -7,19 +7,6 @@ if (!process.env.EE_ENV_LOADED) {
7
7
  process.env.EE_ENV_LOADED = 'true';
8
8
  }
9
9
 
10
- const fs = require('fs');
11
- const Path = require('path');
12
- let SYSTEM_SPECIFIC_CONSTS = {};
13
-
14
- try {
15
- const systemEnvBuf = fs.readFileSync(Path.join(__dirname, '..', 'system.env'));
16
- if (systemEnvBuf && systemEnvBuf.length) {
17
- SYSTEM_SPECIFIC_CONSTS = dotenv.parse(systemEnvBuf);
18
- }
19
- } catch (err) {
20
- // can safely ignore
21
- }
22
-
23
10
  module.exports = {
24
11
  MESSAGE_NEW_NOTIFY: 'messageNew',
25
12
  MESSAGE_NEW_DESCRIPTION: 'New Email - A new email is found in a folder (new email)',
@@ -281,15 +268,3 @@ module.exports = {
281
268
  }
282
269
  }
283
270
  };
284
-
285
- if (SYSTEM_SPECIFIC_CONSTS && typeof SYSTEM_SPECIFIC_CONSTS === 'object') {
286
- for (let key of Object.keys(SYSTEM_SPECIFIC_CONSTS)) {
287
- let value = SYSTEM_SPECIFIC_CONSTS[key];
288
- switch (key) {
289
- case 'EE_DOCKER_LEGACY':
290
- value = !!/^(y|true|[1-9])/i.test(value);
291
- break;
292
- }
293
- module.exports[key] = value;
294
- }
295
- }
@@ -1907,7 +1907,7 @@ class GmailClient extends BaseClient {
1907
1907
  }
1908
1908
  // Pass `call` so Account.update() can dispatch a reconnect back to this worker when
1909
1909
  // OAuth credentials are re-authorized for an account in an error state (same channel the
1910
- // IMAP path uses). Without it, renewAccessToken() -> update() would throw on the reconnect.
1910
+ // IMAP path uses).
1911
1911
  this.accountObject = new Account({ redis: this.redis, account: this.account, secret: await getSecret(), call: msg => this.call(msg) });
1912
1912
  return this.accountObject;
1913
1913
  }
@@ -2840,7 +2840,7 @@ class OutlookClient extends BaseClient {
2840
2840
  }
2841
2841
  // Pass `call` so Account.update() can dispatch a reconnect back to this worker when
2842
2842
  // OAuth credentials are re-authorized for an account in an error state (same channel the
2843
- // IMAP path uses). Without it, renewAccessToken() -> update() would throw on the reconnect.
2843
+ // IMAP path uses).
2844
2844
  this.accountObject = new Account({ redis: this.redis, account: this.account, secret: await getSecret(), call: msg => this.call(msg) });
2845
2845
 
2846
2846
  return this.accountObject;
package/lib/es.js CHANGED
@@ -755,30 +755,3 @@ module.exports = {
755
755
  // immutable copy
756
756
  defaultMappings: Object.freeze(structuredClone(mappings))
757
757
  };
758
-
759
- /*
760
- const { Client: ElasticSearch } = require('@elastic/elasticsearch');
761
- async function main() {
762
- const client = new ElasticSearch({
763
- node: { url: new URL('https://127.0.0.1:9200'), tls: { rejectUnauthorized: false } },
764
- auth: {
765
- username: 'elastic',
766
- password: 'NqDHHrrPVBQtxy9cvIYa'
767
- }
768
- });
769
-
770
- for (let index of ['mastiff', 'kastiff']) {
771
- console.log(index, await module.exports.ensureIndex(client, index, { mappings, analyzer, tokenizer, filter }));
772
-
773
- await client.index({
774
- index: `${index}.threads`,
775
- id: 'test',
776
- document: {
777
- tere: 'vana'
778
- }
779
- });
780
- }
781
- }
782
-
783
- main().catch(err => console.error(err));
784
- */
@@ -20,7 +20,7 @@ const msgpack = require('msgpack5')();
20
20
 
21
21
  const settings = require('./settings');
22
22
  const { getCounterValues, hasEnvValue, readEnvValue, getBoolean } = require('./tools');
23
- const { REDIS_PREFIX, EE_DOCKER_LEGACY } = require('./consts');
23
+ const { REDIS_PREFIX } = require('./consts');
24
24
  const { oauth2Apps } = require('./oauth2-apps');
25
25
  const passkeys = require('./passkeys');
26
26
  const featureFlags = require('./feature-flags');
@@ -110,9 +110,6 @@ function installChannel() {
110
110
  if (getBoolean(readEnvValue('EENGINE_INSTALL_SCRIPT'))) {
111
111
  return 'script';
112
112
  }
113
- if (EE_DOCKER_LEGACY) {
114
- return 'docker-legacy';
115
- }
116
113
  return 'general';
117
114
  }
118
115
 
@@ -275,7 +272,6 @@ async function collectBeacon({ redis, logger }) {
275
272
  if (on('documentStorePreProcessingEnabled')) dep.push('ds_preproc');
276
273
  if (on('gmailEnabled') || on('outlookEnabled') || on('mailRuEnabled')) dep.push('legacyOauth');
277
274
  if (on('trackSentMessages')) dep.push('trackSent');
278
- if (EE_DOCKER_LEGACY) dep.push('dockerLegacy');
279
275
  await safe(async () => {
280
276
  const ids = await redis.smembers(`${REDIS_PREFIX}wh:i`);
281
277
  if (ids && ids.length && ids.length <= WH_SCAN_LIMIT) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emailengine-app",
3
- "version": "2.73.0",
3
+ "version": "2.73.1",
4
4
  "private": false,
5
5
  "productTitle": "EmailEngine",
6
6
  "description": "Email Sync Engine",
@@ -24,7 +24,6 @@
24
24
  "build-dist-fast": "pkg --debug package.json && npm install && node winconf.js",
25
25
  "licenses": "node list-generate.js",
26
26
  "gettext": "find ./views -name \"*.hbs\" -print0 | xargs -0 xgettext-template -L Handlebars -o translations/messages.pot --force-po && node gettext-extract.js",
27
- "prepare-docker": "echo \"EE_DOCKER_LEGACY=$EE_DOCKER_LEGACY\" >> system.env && cat system.env",
28
27
  "update": "rm -rf node_modules package-lock.json && ncu -u && npm install && ./copy-static-files.sh && npm run licenses && npm run gettext",
29
28
  "test-gmail-api": "node lib/email-client/gmail-client.js --dbs.redis=redis://127.0.0.1/11",
30
29
  "format": "prettier --write 'lib/**/*.js' 'workers/**/*.js' 'test/**/*.js' '*.js'",
package/workers/api.js CHANGED
@@ -3131,16 +3131,6 @@ Include your token in requests using one of these methods:
3131
3131
  });
3132
3132
  }
3133
3133
 
3134
- if (consts.EE_DOCKER_LEGACY) {
3135
- systemAlerts.push({
3136
- url: 'https://learn.emailengine.app/docs/installation/docker',
3137
- level: 'info',
3138
- icon: 'icon-[tabler--brand-docker]',
3139
- message: `The Docker image you are currently using is deprecated. To ensure ongoing support, please transition to <code>postalsys/emailengine</code>.`,
3140
- verbatim: true
3141
- });
3142
- }
3143
-
3144
3134
  // Check if setup warnings should be disabled (for documentation screenshots, CI, etc.)
3145
3135
  const disableSetupWarnings = hasEnvValue('EENGINE_DISABLE_SETUP_WARNINGS') ? getBoolean(readEnvValue('EENGINE_DISABLE_SETUP_WARNINGS')) : false;
3146
3136
 
package/.env.development DELETED
@@ -1,49 +0,0 @@
1
- # EmailEngine Development Environment Configuration
2
- # This file contains default settings for local development
3
-
4
- # ===========================================
5
- # BASIC CONFIGURATION
6
- # ===========================================
7
-
8
- # Encryption secret (use default for development)
9
- EENGINE_SECRET=default-dev-secret-change-in-production
10
-
11
- # Redis connection (no password for development)
12
- EENGINE_REDIS=redis://redis:6379/2
13
-
14
- # Number of worker processes (lower for development)
15
- EENGINE_WORKERS=2
16
-
17
- # EmailEngine settings for development
18
- EENGINE_SETTINGS={"smtpServerEnabled": true, "smtpServerPort": 2525, "smtpServerHost": "0.0.0.0", "smtpServerAuthEnabled": true, "smtpServerPassword": "devpassword"}
19
-
20
- # ===========================================
21
- # SERVICE EXPOSURE
22
- # ===========================================
23
-
24
- # Bind to all interfaces for development
25
- EMAILENGINE_API_BIND=0.0.0.0
26
- EMAILENGINE_SMTP_BIND=0.0.0.0
27
- EMAILENGINE_IMAP_BIND=0.0.0.0
28
-
29
- # ===========================================
30
- # REDIS CONFIGURATION
31
- # ===========================================
32
-
33
- # Redis is used as a database, not a cache
34
- # No memory limit is set for development
35
- # Eviction policy is set to 'noeviction' to prevent data loss
36
-
37
- # ===========================================
38
- # LOGGING
39
- # ===========================================
40
-
41
- EENGINE_LOG_LEVEL=debug
42
- REDIS_LOG_LEVEL=notice
43
-
44
- # ===========================================
45
- # HEALTH CHECKS (RELAXED FOR DEVELOPMENT)
46
- # ===========================================
47
-
48
- REDIS_HEALTHCHECK=service_started
49
- HEALTHCHECK_INTERVAL=60s
package/.env.example DELETED
@@ -1,82 +0,0 @@
1
- # EmailEngine Test Environment Variables
2
- # Copy this file to .env and fill in your actual values
3
-
4
- # =============================================================================
5
- # Gmail API OAuth2 Configuration (Full Access)
6
- # =============================================================================
7
- # Required for Gmail API tests with read/write/modify permissions
8
- # Get these credentials from: https://console.cloud.google.com/apis/credentials
9
-
10
- # Google Cloud Project ID for Gmail API
11
- GMAIL_API_PROJECT_ID="your-project-id"
12
-
13
- # OAuth2 Client credentials (for user authentication)
14
- GMAIL_API_CLIENT_ID="your-client-id.apps.googleusercontent.com"
15
- GMAIL_API_CLIENT_SECRET="your-client-secret"
16
-
17
- # Service Account credentials (for Gmail Pub/Sub watch notifications)
18
- GMAIL_API_SERVICE_EMAIL="your-service-account@your-project.iam.gserviceaccount.com"
19
- GMAIL_API_SERVICE_CLIENT="your-service-client-id"
20
- GMAIL_API_SERVICE_KEY="-----BEGIN PRIVATE KEY-----\nyour-service-account-private-key\n-----END PRIVATE KEY-----\n"
21
-
22
- # Test Gmail accounts with full access (gmail.modify scope)
23
- GMAIL_API_ACCOUNT_EMAIL_1="test.account.1@example.com"
24
- GMAIL_API_ACCOUNT_REFRESH_1="1//0c-your-refresh-token-1"
25
-
26
- GMAIL_API_ACCOUNT_EMAIL_2="test.account.2@example.com"
27
- GMAIL_API_ACCOUNT_REFRESH_2="1//0c-your-refresh-token-2"
28
-
29
- # =============================================================================
30
- # Gmail Send-Only Configuration
31
- # =============================================================================
32
- # Required for Gmail send-only account tests (gmail.send scope only)
33
- # This is a separate OAuth2 client configured with only gmail.send permission
34
-
35
- # Google Cloud Project ID for send-only Gmail
36
- GMAIL_SENDONLY_PROJECT_ID="your-sendonly-project-id"
37
-
38
- # OAuth2 Client credentials for send-only access
39
- GMAIL_SENDONLY_CLIENT_ID="your-sendonly-client-id.apps.googleusercontent.com"
40
- GMAIL_SENDONLY_CLIENT_SECRET="your-sendonly-client-secret"
41
-
42
- # Test Gmail account with send-only access
43
- GMAIL_SENDONLY_ACCOUNT_EMAIL="sendonly.test@example.com"
44
- GMAIL_SENDONLY_ACCOUNT_REFRESH="1//0c-your-sendonly-refresh-token"
45
-
46
- # =============================================================================
47
- # Setup Instructions
48
- # =============================================================================
49
- #
50
- # 1. Gmail API Full Access Setup:
51
- # a. Create a Google Cloud project
52
- # b. Enable Gmail API
53
- # c. Create OAuth2 credentials (Web application)
54
- # d. Add authorized redirect URI: http://127.0.0.1:3000/oauth
55
- # e. Configure OAuth consent screen
56
- # f. Add scopes: gmail.modify, gmail.labels, gmail.send
57
- # g. Create a Service Account for Pub/Sub notifications
58
- #
59
- # 2. Gmail Send-Only Setup:
60
- # a. Create a separate Google Cloud project (or use the same)
61
- # b. Enable Gmail API
62
- # c. Create separate OAuth2 credentials
63
- # d. Add scopes: gmail.send, openid, email, profile (only)
64
- # e. DO NOT add gmail.modify, gmail.readonly, or gmail.labels
65
- #
66
- # 3. Getting Refresh Tokens:
67
- # - Use OAuth2 authorization flow to authenticate test users
68
- # - Store the refresh tokens in this .env file
69
- # - Refresh tokens start with "1//0c" for Google OAuth2
70
- #
71
- # 4. Getting Service Account Key:
72
- # - Create a Service Account in Google Cloud Console
73
- # - Generate and download JSON key file
74
- # - Extract the private_key field and paste it here
75
- # - Keep newlines as literal "\n" in the string
76
- #
77
- # =============================================================================
78
- # Security Notice
79
- # =============================================================================
80
- # WARNING: Never commit .env file with real credentials to version control!
81
- # Add .env to your .gitignore file
82
- # Only commit this .env.example file with placeholder values
package/.env.production DELETED
@@ -1,87 +0,0 @@
1
- # EmailEngine Production Environment Configuration
2
- # Copy this file to .env and configure with your actual values
3
-
4
- # ===========================================
5
- # REQUIRED SECURITY SETTINGS
6
- # ===========================================
7
-
8
- # Encryption secret for EmailEngine (generate with: openssl rand -hex 32)
9
- EENGINE_SECRET=CHANGE_ME_USE_STRONG_SECRET_HERE
10
-
11
- # Redis password (generate with: openssl rand -base64 32)
12
- REDIS_PASSWORD=CHANGE_ME_USE_STRONG_PASSWORD_HERE
13
-
14
- # Redis connection with authentication
15
- EENGINE_REDIS=redis://:${REDIS_PASSWORD}@redis:6379/2
16
-
17
- # ===========================================
18
- # EMAILENGINE CONFIGURATION
19
- # ===========================================
20
-
21
- # Log level (error, warn, info, debug)
22
- EENGINE_LOG_LEVEL=info
23
-
24
- # Number of worker processes (should match CPU cores, min 4, max 24)
25
- EENGINE_WORKERS=8
26
-
27
- # EmailEngine settings (configure SMTP password)
28
- EENGINE_SETTINGS={"smtpServerEnabled": true, "smtpServerPort": 2525, "smtpServerHost": "0.0.0.0", "smtpServerAuthEnabled": true, "smtpServerPassword": "CHANGE_ME_SMTP_PASSWORD"}
29
-
30
- # ===========================================
31
- # SERVICE EXPOSURE (PRODUCTION)
32
- # ===========================================
33
-
34
- # Bind only to localhost for production (use reverse proxy for external access)
35
- EMAILENGINE_API_BIND=127.0.0.1
36
- EMAILENGINE_SMTP_BIND=127.0.0.1
37
- EMAILENGINE_IMAP_BIND=127.0.0.1
38
-
39
- # Port configuration (optional, defaults shown)
40
- # EMAILENGINE_API_PORT=3000
41
- # EMAILENGINE_SMTP_PORT=2525
42
- # EMAILENGINE_IMAP_PORT=9993
43
-
44
- # ===========================================
45
- # REDIS CONFIGURATION
46
- # ===========================================
47
-
48
- # Redis is used as a database, not a cache
49
- # No memory limit is set - Redis will use available system memory
50
- # Monitor usage with: docker-compose exec redis redis-cli INFO memory
51
- # Eviction policy is set to 'noeviction' to prevent data loss
52
-
53
- # ===========================================
54
- # LOGGING CONFIGURATION
55
- # ===========================================
56
-
57
- # Log levels
58
- REDIS_LOG_LEVEL=notice
59
-
60
- # Log rotation
61
- LOG_MAX_SIZE=100m
62
- LOG_MAX_FILE=10
63
- LOG_COMPRESS=true
64
-
65
- # ===========================================
66
- # HEALTH CHECKS
67
- # ===========================================
68
-
69
- # Use strict health checks for production
70
- REDIS_HEALTHCHECK=service_healthy
71
-
72
- # Health check configuration
73
- HEALTHCHECK_INTERVAL=30s
74
- HEALTHCHECK_TIMEOUT=10s
75
- HEALTHCHECK_RETRIES=3
76
- HEALTHCHECK_START_PERIOD=40s
77
-
78
- # ===========================================
79
- # OTHER SETTINGS
80
- # ===========================================
81
-
82
- # Restart policy
83
- RESTART_POLICY=unless-stopped
84
-
85
- # Docker image versions (optional, latest by default)
86
- # EMAILENGINE_VERSION=latest
87
- # REDIS_VERSION=7-alpine
package/.eslintignore DELETED
@@ -1 +0,0 @@
1
- # placeholder
package/Dockerfile-legacy DELETED
@@ -1,18 +0,0 @@
1
- FROM node:18-alpine
2
-
3
- ENV EE_DOCKER_LEGACY=true
4
-
5
- RUN apk add --no-cache dumb-init
6
-
7
- WORKDIR /emailengine
8
- COPY . .
9
-
10
- RUN npm install --omit=dev
11
- RUN npm run prepare-docker
12
- RUN chmod +x ./update-info.sh
13
- RUN ./update-info.sh
14
-
15
- ENV EENGINE_HOST=0.0.0.0
16
-
17
- ENTRYPOINT ["/usr/bin/dumb-init", "--"]
18
- CMD ["node", "/emailengine/server.js"]