emailengine-app 2.79.6 → 2.79.8

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.
Files changed (109) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +32 -0
  3. package/DOCKER_DEPLOYMENT.md +2 -0
  4. package/bin/emailengine.js +29 -13
  5. package/config/default.toml +13 -3
  6. package/data/google-crawlers.json +7 -1
  7. package/docker-compose.yml +12 -3
  8. package/install.sh +2 -0
  9. package/lib/api-routes/account-routes.js +14 -3
  10. package/lib/api-routes/mailbox-routes.js +4 -1
  11. package/lib/api-routes/message-routes.js +6 -5
  12. package/lib/api-routes/outbox-routes.js +7 -4
  13. package/lib/api-routes/settings-routes.js +34 -25
  14. package/lib/api-routes/stats-routes.js +8 -1
  15. package/lib/api-routes/submit-routes.js +2 -1
  16. package/lib/api-routes/template-routes.js +3 -2
  17. package/lib/bounce-detect.js +45 -0
  18. package/lib/consts.js +9 -3
  19. package/lib/egress-filter.js +39 -4
  20. package/lib/email-client/base-client.js +274 -24
  21. package/lib/email-client/gmail/gmail-api.js +15 -7
  22. package/lib/email-client/gmail-client.js +121 -64
  23. package/lib/email-client/imap/mailbox.js +18 -59
  24. package/lib/email-client/imap-client.js +53 -29
  25. package/lib/email-client/notification-handler.js +11 -2
  26. package/lib/email-client/outlook/graph-api.js +106 -90
  27. package/lib/email-client/outlook-client.js +222 -106
  28. package/lib/generate-text-preview.js +10 -5
  29. package/lib/headers-rewriter.js +1 -1
  30. package/lib/llm-pre-process.js +4 -1
  31. package/lib/mcp/json-schema.js +50 -2
  32. package/lib/outbox.js +22 -5
  33. package/lib/passkeys.js +39 -7
  34. package/lib/pre-process.js +4 -1
  35. package/lib/rewrite-text-nodes.js +12 -1
  36. package/lib/schemas.js +27 -5
  37. package/lib/settings.js +19 -1
  38. package/lib/sso.js +60 -7
  39. package/lib/submit-progress.js +29 -0
  40. package/lib/templates.js +11 -0
  41. package/lib/tools.js +115 -53
  42. package/lib/ui-routes/account-routes.js +79 -12
  43. package/lib/ui-routes/admin-config-routes.js +7 -21
  44. package/lib/ui-routes/admin-entities-routes.js +42 -12
  45. package/lib/ui-routes/auth-routes.js +242 -87
  46. package/lib/ui-routes/dashboard-routes.js +1 -1
  47. package/lib/ui-routes/internals-routes.js +2 -0
  48. package/lib/ui-routes/mcp-consent-routes.js +5 -2
  49. package/lib/ui-routes/network-config-routes.js +12 -3
  50. package/lib/ui-routes/oauth-config-routes.js +12 -1
  51. package/lib/ui-routes/route-helpers.js +41 -6
  52. package/lib/ui-routes/settings-page.js +10 -0
  53. package/lib/ui-routes/suppression-list-routes.js +16 -5
  54. package/lib/ui-routes/unsubscribe-routes.js +22 -3
  55. package/lib/webhooks.js +14 -2
  56. package/package.json +17 -17
  57. package/sbom.json +1 -1
  58. package/server.js +63 -35
  59. package/static/css/flyonui.css +1 -1
  60. package/static/css/src/app.tailwind.css +55 -0
  61. package/static/js/app.js +4 -35
  62. package/static/js/passkey-register.js +50 -1
  63. package/static/js/public.js +128 -0
  64. package/static/js/ui.js +183 -6
  65. package/static/licenses.html +371 -770
  66. package/translations/messages.pot +66 -66
  67. package/views/account/passkeys.hbs +141 -0
  68. package/views/account/password.hbs +11 -0
  69. package/views/account/security.hbs +318 -326
  70. package/views/accounts/account.hbs +90 -115
  71. package/views/accounts/register/imap-server.hbs +18 -12
  72. package/views/config/ai.hbs +2 -0
  73. package/views/config/branding.hbs +2 -0
  74. package/views/config/document-store/index.hbs +6 -6
  75. package/views/config/email-processing.hbs +2 -0
  76. package/views/config/imap-proxy.hbs +2 -0
  77. package/views/config/license.hbs +4 -1
  78. package/views/config/logging.hbs +3 -1
  79. package/views/config/mcp.hbs +2 -0
  80. package/views/config/network.hbs +2 -0
  81. package/views/config/oauth/app.hbs +3 -3
  82. package/views/config/oauth/edit.hbs +1 -1
  83. package/views/config/oauth/new.hbs +1 -1
  84. package/views/config/security.hbs +2 -0
  85. package/views/config/service.hbs +2 -0
  86. package/views/config/smtp.hbs +2 -0
  87. package/views/config/webhooks.hbs +9 -6
  88. package/views/error.hbs +6 -0
  89. package/views/layout/app.hbs +6 -3
  90. package/views/layout/login.hbs +1 -1
  91. package/views/layout/prompt.hbs +1 -1
  92. package/views/layout/public.hbs +1 -1
  93. package/views/legal.hbs +1 -1
  94. package/views/partials/filter_editor_js.hbs +1 -1
  95. package/views/partials/gateway_js.hbs +7 -6
  96. package/views/partials/oauth_form.hbs +5 -5
  97. package/views/partials/ui/btn.hbs +8 -2
  98. package/views/partials/ui/confirm-modal.hbs +2 -3
  99. package/views/partials/ui/empty-state.hbs +25 -0
  100. package/views/partials/ui/env-managed-alert.hbs +19 -0
  101. package/views/partials/webhook_form.hbs +1 -1
  102. package/views/partials/webhooks_editor_functions.hbs +5 -5
  103. package/views/unsubscribe.hbs +6 -0
  104. package/workers/api.js +193 -81
  105. package/workers/imap.js +32 -3
  106. package/workers/smtp.js +7 -0
  107. package/workers/submit.js +25 -1
  108. package/workers/webhooks.js +13 -17
  109. package/lib/reconnection-manager.js +0 -106
@@ -9,7 +9,7 @@
9
9
  <meta name="description" content="EmailEngine Application page; The Ultimate Email API for Developers" />
10
10
  <meta name="author" content="Postal Systems OÜ">
11
11
 
12
- <title>{{#if pageTitleFull}}{{pageTitleFull}}{{else}}{{pageBrandName}}{{#if pageTitle}} &ndash;
12
+ <title>{{#if pageTitleFull}}{{pageTitleFull}}{{else}}{{pageBrandName}}{{#if pageTitle}} -
13
13
  {{pageTitle}}{{/if}}{{/if}}</title>
14
14
 
15
15
  {{> head_assets}}
@@ -53,7 +53,10 @@
53
53
 
54
54
  <!-- Topbar -->
55
55
  <header class="bg-base-100 border-base-content/20 sticky top-0 z-30 border-b">
56
- <nav class="navbar flex items-center gap-2 px-6 py-2">
56
+ {{!-- flex-wrap: on phones the search form drops to a full-width second row (see its
57
+ max-sm classes) instead of disappearing, so the account search and the state
58
+ filter stay reachable without a redesign of the bar --}}
59
+ <nav class="navbar flex flex-wrap items-center gap-2 px-6 py-2">
57
60
 
58
61
  <button type="button" class="btn btn-text btn-circle btn-sm lg:hidden" aria-haspopup="dialog"
59
62
  aria-expanded="false" aria-controls="layout-sidebar" data-overlay="#layout-sidebar"
@@ -63,7 +66,7 @@
63
66
 
64
67
  {{#if searchTarget}}
65
68
  <!-- Topbar search -->
66
- <form class="hidden sm:flex items-center gap-2 grow max-w-xl" method="get" action="{{searchTarget}}">
69
+ <form class="flex items-center gap-2 grow max-w-xl max-sm:order-last max-sm:w-full max-sm:max-w-none" method="get" action="{{searchTarget}}">
67
70
 
68
71
  {{#if stateOptions}}
69
72
  <div class="dropdown relative inline-flex shrink-0">
@@ -9,7 +9,7 @@
9
9
  <meta name="description" content="EmailEngine Application page; The Ultimate Email API for Developers" />
10
10
  <meta name="author" content="Postal Systems OÜ">
11
11
 
12
- <title>{{#if pageTitleFull}}{{pageTitleFull}}{{else}}{{pageBrandName}}{{#if pageTitle}} &ndash;
12
+ <title>{{#if pageTitleFull}}{{pageTitleFull}}{{else}}{{pageBrandName}}{{#if pageTitle}} -
13
13
  {{pageTitle}}{{/if}}{{/if}}</title>
14
14
 
15
15
  {{> head_assets}}
@@ -9,7 +9,7 @@
9
9
  <meta name="description" content="EmailEngine Application page; The Ultimate Email API for Developers" />
10
10
  <meta name="author" content="Postal Systems OÜ">
11
11
 
12
- <title>{{#if pageTitleFull}}{{pageTitleFull}}{{else}}{{pageBrandName}}{{#if pageTitle}} &ndash;
12
+ <title>{{#if pageTitleFull}}{{pageTitleFull}}{{else}}{{pageBrandName}}{{#if pageTitle}} -
13
13
  {{pageTitle}}{{/if}}{{/if}}</title>
14
14
 
15
15
  {{> head_assets}}
@@ -9,7 +9,7 @@
9
9
  <meta name="description" content="EmailEngine Application page; The Ultimate Email API for Developers" />
10
10
  <meta name="author" content="Postal Systems OÜ">
11
11
 
12
- <title>{{#if pageTitleFull}}{{pageTitleFull}}{{else}}{{pageBrandName}}{{#if pageTitle}} &ndash;
12
+ <title>{{#if pageTitleFull}}{{pageTitleFull}}{{else}}{{pageBrandName}}{{#if pageTitle}} -
13
13
  {{pageTitle}}{{/if}}{{/if}}</title>
14
14
 
15
15
  <link rel="apple-touch-icon" href="/static/favicon/apple-touch-icon.png" sizes="180x180" />
package/views/legal.hbs CHANGED
@@ -38,7 +38,7 @@
38
38
 
39
39
 
40
40
  </strong>
41
- &mdash; <a class="link link-animated" href="/admin/config/license">View license details</a>
41
+ - <a class="link link-animated" href="/admin/config/license">View license details</a>
42
42
  </li>
43
43
 
44
44
  <li class="px-6 py-4">
@@ -43,7 +43,7 @@
43
43
  <div class="modal-footer justify-between">
44
44
  <div>
45
45
  <select class="select" id="select-predefined-payload">
46
- <option>{{#if selectPlaceholder}}{{selectPlaceholder}}{{else}} -- Select predefined payload -- {{/if}}</option>
46
+ <option>{{#if selectPlaceholder}}{{selectPlaceholder}}{{else}}Select a predefined payload{{/if}}</option>
47
47
  </select>
48
48
  </div>
49
49
  {{> ui/btn label="Close" variant="neutral" style="soft" overlay="#setPayloadModal"}}
@@ -58,13 +58,14 @@
58
58
  return await uiPostJson('/admin/gateways/test', payload);
59
59
  }
60
60
 
61
- document.getElementById('test-verify-btn').addEventListener('click', e => {
61
+ const testVerifyBtn = document.getElementById('test-verify-btn');
62
+ testVerifyBtn.addEventListener('click', e => {
62
63
  e.preventDefault()
63
- sendTestPayload().then(data => {
64
- showToast(data.error ? data.error : (data.success ? data.message || 'Connection successful' : 'Failed to establish connection'), data.success ? 'check-circle' : 'alert-triangle');
65
- }).catch(err => {
66
- showToast('Request failed\n' + err.message, 'alert-triangle');
67
- })
64
+ // Busy for as long as the SMTP server takes to answer - otherwise the button looks
65
+ // unpressed and gets clicked again, opening another connection to the same server.
66
+ uiBusyAction(testVerifyBtn, () =>
67
+ sendTestPayload().then(data => uiToastResult(data, data.message || 'Connection successful', 'Failed to establish connection'))
68
+ );
68
69
  });
69
70
  })
70
71
  </script>
@@ -248,7 +248,7 @@ Read about setting up {{providerData.comment}} from <a href="{{providerData.tuto
248
248
 
249
249
  {{#each azureClouds}}
250
250
  <option value="{{id}}" {{#if selected}}selected{{/if}}>{{name}}{{#if
251
- description}} &mdash;
251
+ description}} -
252
252
  {{description}}{{/if}}</option>
253
253
  {{/each}}
254
254
  </select>
@@ -329,7 +329,7 @@ Read about setting up {{providerData.comment}} from <a href="{{providerData.tuto
329
329
 
330
330
  {{#each azureClouds}}
331
331
  <option value="{{id}}" {{#if selected}}selected{{/if}}>{{name}}{{#if
332
- description}} &mdash;
332
+ description}} -
333
333
  {{description}}{{/if}}</option>
334
334
  {{/each}}
335
335
  </select>
@@ -648,12 +648,12 @@ Read about setting up {{providerData.comment}} from <a href="{{providerData.tuto
648
648
  <select class="select w-full{{#if errors.pubSubApp}} is-invalid{{/if}}" id="pubSubApp"
649
649
  name="pubSubApp" {{#unless baseScopesApi}}disabled{{/unless}}>
650
650
 
651
- <option value=""> &mdash; Select the service account for your project &mdash; </option>
651
+ <option value="">Select the service account for your project</option>
652
652
 
653
653
  {{#each pubSubApps}}
654
654
  <option value="{{id}}" data-project="{{googleProjectId}}" {{#if selected}}selected{{/if}} {{#unless
655
655
  baseScopesApi}}disabled{{/unless}}>{{name}}{{#if
656
- description}} &mdash;
656
+ description}} -
657
657
  {{description}}{{/if}} [{{googleProjectId}}]</option>
658
658
  {{/each}}
659
659
 
@@ -787,7 +787,7 @@ Read about setting up {{providerData.comment}} from <a href="{{providerData.tuto
787
787
 
788
788
  <div class="card-body">
789
789
  <input type="hidden" name="baseScopes" value="api" />
790
- <p><strong>MS Graph API</strong> &mdash; This app uses Microsoft Graph API with application permissions
790
+ <p><strong>MS Graph API</strong> - This app uses Microsoft Graph API with application permissions
791
791
  (client credentials). Requires <code>Mail.ReadWrite</code>, <code>Mail.Send</code>, and
792
792
  <code>User.Read.All</code> application permissions with admin consent in Entra.</p>
793
793
  </div>
@@ -18,9 +18,15 @@
18
18
  id - element id (optional)
19
19
  class - extra classes (optional)
20
20
  overlay - value for data-overlay to open/close a ui/modal (optional)
21
+ disabled - truthy to render the button disabled. Also adds pointer-events-none,
22
+ because a disabled control dispatches no mouse events and a wrapping
23
+ {{#> ui/tooltip}} would never see the hover that is meant to explain
24
+ why the button is off. Ignored entirely by the href form - a link
25
+ cannot be disabled, and half-disabling one (unclickable but still
26
+ keyboard-reachable) is worse than not offering it.
21
27
  --}}
22
28
  {{#*inline "btnClasses"~}}
23
- btn{{#unless bare}} btn-{{#if variant}}{{variant}}{{else}}primary{{/if}}{{/unless}}{{#if style}} btn-{{style}}{{/if}}{{#if size}} btn-{{size}}{{/if}}{{#if class}} {{class}}{{/if}}
29
+ btn{{#unless bare}} btn-{{#if variant}}{{variant}}{{else}}primary{{/if}}{{/unless}}{{#if style}} btn-{{style}}{{/if}}{{#if size}} btn-{{size}}{{/if}}{{#unless href}}{{#if disabled}} pointer-events-none{{/if}}{{/unless}}{{#if class}} {{class}}{{/if}}
24
30
  {{~/inline}}
25
31
  {{#*inline "btnContent"~}}
26
32
  {{#if icon}}<span class="{{icon}} size-4 shrink-0"></span>{{/if}}{{label}}
@@ -28,5 +34,5 @@ btn{{#unless bare}} btn-{{#if variant}}{{variant}}{{else}}primary{{/if}}{{/unles
28
34
  {{#if href}}
29
35
  <a href="{{href}}" {{#if id}}id="{{id}}" {{/if}}{{#if external}}target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" {{/if}}class="{{> btnClasses}}">{{> btnContent}}</a>
30
36
  {{else}}
31
- <button type="{{#if type}}{{type}}{{else}}button{{/if}}" {{#if id}}id="{{id}}" {{/if}}{{#if overlay}}data-overlay="{{overlay}}" {{/if}}class="{{> btnClasses}}">{{> btnContent}}</button>
37
+ <button type="{{#if type}}{{type}}{{else}}button{{/if}}" {{#if id}}id="{{id}}" {{/if}}{{#if overlay}}data-overlay="{{overlay}}" {{/if}}{{#if disabled}}disabled {{/if}}class="{{> btnClasses}}">{{> btnContent}}</button>
32
38
  {{/if}}
@@ -21,15 +21,14 @@
21
21
  shared .list-delete-btn handler can fill it (optional)
22
22
  formId - id on the form element (optional)
23
23
  formTarget - form target, e.g. "_blank" for download responses (optional)
24
- formClass - extra classes on the form, e.g. "pending-form" (optional)
25
24
  --}}
26
25
  {{#> ui/modal id=id title=title titleId=titleId}}
27
26
  <div class="modal-body">
28
27
  {{!-- own hash params neutralized against fallthrough into the block --}}
29
- {{> @partial-block id="" title="" titleId="" action="" submitLabel="" submitVariant="" submitIcon="" fieldName="" fieldValue="" fieldId="" fieldClass="" formId="" formTarget="" formClass=""}}
28
+ {{> @partial-block id="" title="" titleId="" action="" submitLabel="" submitVariant="" submitIcon="" fieldName="" fieldValue="" fieldId="" fieldClass="" formId="" formTarget=""}}
30
29
  </div>
31
30
  <div class="modal-footer">
32
- <form method="post" action="{{action}}"{{#if formId}} id="{{formId}}"{{/if}}{{#if formTarget}} target="{{formTarget}}" rel="noopener noreferrer"{{/if}} class="{{#if formClass}}{{formClass}} {{/if}}flex gap-2">
31
+ <form method="post" action="{{action}}"{{#if formId}} id="{{formId}}"{{/if}}{{#if formTarget}} target="{{formTarget}}" rel="noopener noreferrer"{{/if}} class="flex gap-2">
33
32
  <input type="hidden" name="crumb" value="{{crumb}}">
34
33
  {{#if fieldName}}
35
34
  <input type="hidden"{{#if fieldId}} id="{{fieldId}}"{{/if}}{{#if fieldClass}} class="{{fieldClass}}"{{/if}} name="{{fieldName}}" value="{{fieldValue}}">
@@ -0,0 +1,25 @@
1
+ {{!--
2
+ ui/empty-state - centered "nothing here yet" placeholder for the inside of a card that
3
+ brings its own header and primary action (the passkeys card on the account security
4
+ page). Block form; the block is the explanatory sentence under the title:
5
+ {{#> ui/empty-state icon="icon-[tabler--fingerprint]" title="No passkeys registered"}}
6
+ Register this device to sign in without typing a password.
7
+ {{/ui/empty-state}}
8
+ ui/list-empty is the sibling for a whole list page: it wraps itself in a card and its
9
+ copy is search/filter-aware, which is why it cannot be nested inside a card.
10
+ NB the partial-block pitfall - a block whose content is nothing but a {{#if}} wrapper
11
+ loses it. Hoist such a condition outside the call and use one block per arm.
12
+ Params:
13
+ icon - full iconify class for the muted glyph (optional; pass the complete class so
14
+ the Tailwind scanner sees it at the call site)
15
+ title - bold headline (required)
16
+ class - extra classes on the wrapper (optional)
17
+ --}}
18
+ <div class="flex flex-col items-center gap-2 py-6 text-center{{#if class}} {{class}}{{/if}}">
19
+ {{#if icon}}<span class="{{icon}} text-base-content/30 size-10"></span>{{/if}}
20
+ <p class="mb-0 font-medium">{{title}}</p>
21
+ {{#if @partial-block}}
22
+ {{!-- own hash params neutralized against fallthrough into the block --}}
23
+ <p class="text-base-content/60 mb-0 max-w-md text-sm">{{> @partial-block icon="" title="" class=""}}</p>
24
+ {{/if}}
25
+ </div>
@@ -0,0 +1,19 @@
1
+ {{!--
2
+ ui/env-managed-alert - notice for the settings pages registered through
3
+ lib/ui-routes/settings-page.js, naming the form fields whose values the EENGINE_SETTINGS
4
+ environment variable re-applies on every boot. A value saved for one of them holds only
5
+ until the next restart, and without this the page would show the save succeeding.
6
+ Renders nothing when the page has no such field. The inputs stay enabled on purpose -
7
+ a disabled control drops out of the POST and would silently strip its value from the
8
+ save - so the notice is the whole treatment.
9
+ {{> ui/env-managed-alert}}
10
+ Reads `envManagedKeys` (array of field names) from the page context; registerSettingsPage
11
+ sets it on every render of the page.
12
+ --}}
13
+ {{#if envManagedKeys.length}}
14
+ {{#> ui/alert-banner variant="info" icon="icon-[tabler--info-circle]" title="Some fields are set by the environment"}}
15
+ <div>The following settings come from the <code>EENGINE_SETTINGS</code> environment variable and are re-applied on
16
+ every restart. A value saved here is used until the next restart, then reverts to the environment value:
17
+ {{#each envManagedKeys}}<code>{{this}}</code>{{#unless @last}}, {{/unless}}{{/each}}.</div>
18
+ {{/ui/alert-banner}}
19
+ {{/if}}
@@ -7,7 +7,7 @@
7
7
 
8
8
  {{> ui/form-field id="inputDescription" name="description" label="Description" value=values.description error=errors.description hint="Description for this routing."}}
9
9
 
10
- {{> ui/form-field id="inputTargetUrl" name="targetUrl" type="url" label="Target URL" value=values.targetUrl error=errors.targetUrl required=true placeholder='URL like "https://myservice.com/imap/webhooks"' hint="Webhook target URL for this routing."}}
10
+ {{> ui/form-field id="inputTargetUrl" name="targetUrl" type="url" label="Target URL" value=values.targetUrl error=errors.targetUrl placeholder='URL like "https://myservice.com/imap/webhooks"' hint="Webhook target URL for this routing. Leave empty to deliver to the default webhook URL from the Webhooks settings."}}
11
11
 
12
12
  {{> ui/checkbox id="enabled" label="Enable this webhook route" checked=values.enabled error=errors.enabled hint="Webhook routes are not enabled by default."}}
13
13
 
@@ -19,11 +19,11 @@
19
19
  const testSendBtn = document.getElementById('test-send-btn');
20
20
  testSendBtn.addEventListener('click', e => {
21
21
  e.preventDefault();
22
- sendTestPayload().then(data => {
23
- uiToastResult(data, 'Test payload sent', 'Failed to send payload');
24
- }).catch(err => {
25
- showToast('Request failed\n' + err.message, 'alert-triangle');
26
- })
22
+ // Waits for the target server to answer; clicking again would deliver the preview
23
+ // payload a second time.
24
+ uiBusyAction(testSendBtn, () =>
25
+ sendTestPayload().then(data => uiToastResult(data, 'Test payload sent', 'Failed to send payload'))
26
+ );
27
27
  });
28
28
  });
29
29
  </script>
@@ -59,6 +59,7 @@ focus ring on) the corner close button --}}
59
59
 
60
60
  <h1>{{_ "Unsubscribe" templateLocale }}</h1>
61
61
 
62
+ {{#if values.sig}}
62
63
  <div class="ee-narrow">
63
64
  <form method="post" action="/unsubscribe/address">
64
65
  <input type="hidden" name="crumb" value="{{crumb}}" />
@@ -76,6 +77,11 @@ focus ring on) the corner close button --}}
76
77
  </div>
77
78
  </form>
78
79
  </div>
80
+ {{else}}
81
+ {{!-- A submit whose signed payload did not verify (or a malformed one) leaves nothing
82
+ trustworthy to put in the form, and an empty form would only fail again --}}
83
+ <p>{{_ "This link is not valid. Use the unsubscribe link from the email you received." templateLocale }}</p>
84
+ {{/if}}
79
85
 
80
86
  {{/if}}
81
87