@mavogel/awscdk-rootmail 0.1.42 → 0.1.43
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/.jsii +8 -8
- package/lib/rootmail.js +1 -1
- package/lib/ses-receive.js +1 -1
- package/node_modules/@aws-sdk/checksums/package.json +3 -3
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-cloudwatch-logs/package.json +4 -4
- package/node_modules/@aws-sdk/client-route-53/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-route-53/package.json +4 -4
- package/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-s3/package.json +7 -7
- package/node_modules/@aws-sdk/client-ses/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-ses/package.json +4 -4
- package/node_modules/@aws-sdk/client-ssm/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-ssm/package.json +4 -4
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js +1 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/client/setFeature.js +0 -2
- package/node_modules/@aws-sdk/core/package.json +4 -5
- package/node_modules/@aws-sdk/credential-provider-env/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-http/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +10 -10
- package/node_modules/@aws-sdk/credential-provider-login/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-node/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-process/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +4 -4
- package/node_modules/@aws-sdk/middleware-sdk-s3/package.json +3 -3
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/package.json +3 -3
- package/node_modules/@aws-sdk/token-providers/package.json +4 -4
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.browser.js +8 -8
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js +8 -8
- package/node_modules/@smithy/core/dist-es/submodules/retry/util-retry/StandardRetryStrategy.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/retry/util-retry/retries-2026-config.js +6 -6
- package/node_modules/@smithy/core/dist-types/submodules/retry/util-retry/retries-2026-config.d.ts +16 -6
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/retry/util-retry/retries-2026-config.d.ts +16 -6
- package/node_modules/@smithy/core/package.json +1 -1
- package/node_modules/mailparser/CHANGELOG.md +7 -0
- package/node_modules/mailparser/package.json +3 -3
- package/node_modules/nodemailer/CHANGELOG.md +28 -0
- package/node_modules/nodemailer/README.md +21 -0
- package/node_modules/nodemailer/dist/cjs/addressparser/index.js +185 -2
- package/node_modules/nodemailer/dist/cjs/dkim/sign.js +2 -2
- package/node_modules/nodemailer/dist/cjs/errors.d.ts +2 -0
- package/node_modules/nodemailer/dist/cjs/errors.js +11 -1
- package/node_modules/nodemailer/dist/cjs/json-transport/index.js +2 -0
- package/node_modules/nodemailer/dist/cjs/mailer/index.d.ts +12 -2
- package/node_modules/nodemailer/dist/cjs/mailer/index.js +56 -4
- package/node_modules/nodemailer/dist/cjs/mailer/mail-message.d.ts +10 -0
- package/node_modules/nodemailer/dist/cjs/mime-funcs/index.d.ts +2 -1
- package/node_modules/nodemailer/dist/cjs/mime-funcs/index.js +72 -2
- package/node_modules/nodemailer/dist/cjs/mime-node/index.js +1 -73
- package/node_modules/nodemailer/dist/cjs/package-info.d.ts +1 -1
- package/node_modules/nodemailer/dist/cjs/package-info.js +1 -1
- package/node_modules/nodemailer/dist/cjs/shared/index.d.ts +23 -0
- package/node_modules/nodemailer/dist/cjs/shared/index.js +79 -0
- package/node_modules/nodemailer/dist/cjs/smtp-connection/index.js +6 -0
- package/node_modules/nodemailer/dist/cjs/smtp-pool/index.d.ts +10 -3
- package/node_modules/nodemailer/dist/cjs/smtp-pool/index.js +70 -12
- package/node_modules/nodemailer/dist/cjs/smtp-pool/pool-resource.js +26 -4
- package/node_modules/nodemailer/dist/cjs/smtp-transport/index.d.ts +1 -0
- package/node_modules/nodemailer/dist/cjs/smtp-transport/index.js +47 -35
- package/node_modules/nodemailer/dist/cjs/well-known/services.js +7 -0
- package/node_modules/nodemailer/dist/esm/addressparser/index.js +185 -2
- package/node_modules/nodemailer/dist/esm/dkim/sign.js +2 -2
- package/node_modules/nodemailer/dist/esm/errors.d.ts +2 -0
- package/node_modules/nodemailer/dist/esm/errors.js +9 -0
- package/node_modules/nodemailer/dist/esm/json-transport/index.js +2 -0
- package/node_modules/nodemailer/dist/esm/mailer/index.d.ts +12 -2
- package/node_modules/nodemailer/dist/esm/mailer/index.js +56 -4
- package/node_modules/nodemailer/dist/esm/mailer/mail-message.d.ts +10 -0
- package/node_modules/nodemailer/dist/esm/mime-funcs/index.d.ts +2 -1
- package/node_modules/nodemailer/dist/esm/mime-funcs/index.js +72 -2
- package/node_modules/nodemailer/dist/esm/mime-node/index.js +1 -73
- package/node_modules/nodemailer/dist/esm/package-info.d.ts +1 -1
- package/node_modules/nodemailer/dist/esm/package-info.js +1 -1
- package/node_modules/nodemailer/dist/esm/shared/index.d.ts +23 -0
- package/node_modules/nodemailer/dist/esm/shared/index.js +78 -0
- package/node_modules/nodemailer/dist/esm/smtp-connection/index.js +6 -0
- package/node_modules/nodemailer/dist/esm/smtp-pool/index.d.ts +10 -3
- package/node_modules/nodemailer/dist/esm/smtp-pool/index.js +70 -12
- package/node_modules/nodemailer/dist/esm/smtp-pool/pool-resource.js +26 -4
- package/node_modules/nodemailer/dist/esm/smtp-transport/index.d.ts +1 -0
- package/node_modules/nodemailer/dist/esm/smtp-transport/index.js +47 -35
- package/node_modules/nodemailer/dist/esm/well-known/services.js +7 -0
- package/node_modules/nodemailer/dist/well-known/services.json +8 -0
- package/node_modules/nodemailer/package.json +7 -7
- package/package.json +7 -7
|
@@ -18,6 +18,7 @@ const REQUEUE_MAX_DELAY = 2000;
|
|
|
18
18
|
class SMTPPool extends EventEmitter {
|
|
19
19
|
constructor(options) {
|
|
20
20
|
super();
|
|
21
|
+
this.supportsAbortSignal = true;
|
|
21
22
|
options = options || {};
|
|
22
23
|
if (typeof options === 'string') {
|
|
23
24
|
options = {
|
|
@@ -96,20 +97,33 @@ class SMTPPool extends EventEmitter {
|
|
|
96
97
|
return false;
|
|
97
98
|
}
|
|
98
99
|
// counted until the callback runs, whichever path runs it: delivered, failed, requeued
|
|
99
|
-
// until it gives up, or drained by close()
|
|
100
|
+
// until it gives up, aborted, or drained by close()
|
|
100
101
|
let counted = true;
|
|
102
|
+
let detachSignal;
|
|
101
103
|
this._pending++;
|
|
102
|
-
|
|
104
|
+
const entry = {
|
|
103
105
|
mail,
|
|
104
106
|
requeueAttempts: 0,
|
|
105
107
|
callback: (err, info) => {
|
|
106
|
-
if (counted) {
|
|
107
|
-
|
|
108
|
-
this._pending--;
|
|
108
|
+
if (!counted) {
|
|
109
|
+
return;
|
|
109
110
|
}
|
|
111
|
+
counted = false;
|
|
112
|
+
this._pending--;
|
|
113
|
+
detachSignal?.();
|
|
114
|
+
entry.resource = undefined;
|
|
110
115
|
callback(err, info);
|
|
111
116
|
}
|
|
112
|
-
}
|
|
117
|
+
};
|
|
118
|
+
this._queue.push(entry);
|
|
119
|
+
const signal = mail.data.signal;
|
|
120
|
+
if (signal) {
|
|
121
|
+
// one listener for the original entry, retained across connection-close retries
|
|
122
|
+
detachSignal = this._watchAbortSignal(entry, signal, () => counted);
|
|
123
|
+
if (signal.aborted) {
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
113
127
|
if (this.idling && this._queue.length >= this.options.maxConnections) {
|
|
114
128
|
this.idling = false;
|
|
115
129
|
}
|
|
@@ -117,10 +131,49 @@ class SMTPPool extends EventEmitter {
|
|
|
117
131
|
return true;
|
|
118
132
|
}
|
|
119
133
|
/**
|
|
120
|
-
*
|
|
121
|
-
*
|
|
134
|
+
* Fails a queued or assigned entry when its signal aborts: removes it from the queue, or
|
|
135
|
+
* closes the connection delivering it, so other deliveries in the pool can continue.
|
|
136
|
+
* Returns a function that removes the listener.
|
|
137
|
+
* @internal
|
|
138
|
+
*/
|
|
139
|
+
_watchAbortSignal(entry, signal, isPending) {
|
|
140
|
+
const onAbort = () => {
|
|
141
|
+
if (!isPending()) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const index = this._queue.indexOf(entry);
|
|
145
|
+
if (index !== -1) {
|
|
146
|
+
this._queue.splice(index, 1);
|
|
147
|
+
}
|
|
148
|
+
const resource = entry.resource;
|
|
149
|
+
if (resource && resource.queueEntry === entry) {
|
|
150
|
+
// Detach before closing: the close handler must not retry this message.
|
|
151
|
+
resource.queueEntry = false;
|
|
152
|
+
resource.close();
|
|
153
|
+
}
|
|
154
|
+
try {
|
|
155
|
+
entry.callback(errors.createAbortError(signal));
|
|
156
|
+
}
|
|
157
|
+
finally {
|
|
158
|
+
// Removing a queued entry can make the pool idle again.
|
|
159
|
+
setImmediate(() => this._processMessages());
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
163
|
+
if (signal.aborted) {
|
|
164
|
+
setImmediate(onAbort);
|
|
165
|
+
}
|
|
166
|
+
return () => signal.removeEventListener('abort', onAbort);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Closes the pool. Idle connections are closed at once and a connection in the middle of a
|
|
170
|
+
* delivery finishes it first, unless `force` is set: then it is closed too and its message
|
|
171
|
+
* fails. `force` is for a caller that has given up on a delivery, such as one a server is
|
|
172
|
+
* stalling by trickling its replies, which no socket timeout notices.
|
|
173
|
+
*
|
|
174
|
+
* @param options.force - Also close connections that are delivering a message
|
|
122
175
|
*/
|
|
123
|
-
close() {
|
|
176
|
+
close(options) {
|
|
124
177
|
let connection;
|
|
125
178
|
const len = this._connections.length;
|
|
126
179
|
this._closed = true;
|
|
@@ -131,9 +184,10 @@ class SMTPPool extends EventEmitter {
|
|
|
131
184
|
if (!len && !this._queue.length) {
|
|
132
185
|
return;
|
|
133
186
|
}
|
|
134
|
-
// remove all available connections
|
|
187
|
+
// remove all available connections, and with `force` the busy ones too
|
|
188
|
+
const force = !!options?.force;
|
|
135
189
|
for (let i = len - 1; i >= 0; i--) {
|
|
136
|
-
if (this._connections[i] && this._connections[i].available) {
|
|
190
|
+
if (this._connections[i] && (force || this._connections[i].available)) {
|
|
137
191
|
connection = this._connections[i];
|
|
138
192
|
connection.close();
|
|
139
193
|
this.logger.info({
|
|
@@ -211,6 +265,7 @@ class SMTPPool extends EventEmitter {
|
|
|
211
265
|
this.emit('idle');
|
|
212
266
|
}
|
|
213
267
|
const entry = (connection.queueEntry = this._queue.shift());
|
|
268
|
+
entry.resource = connection;
|
|
214
269
|
entry.messageId = (connection.queueEntry.mail.message.getHeader('message-id') || '').replace(/[<>\s]/g, '');
|
|
215
270
|
connection.available = false;
|
|
216
271
|
this.logger.debug({
|
|
@@ -318,7 +373,9 @@ class SMTPPool extends EventEmitter {
|
|
|
318
373
|
setTimeout(() => {
|
|
319
374
|
let delay = 0;
|
|
320
375
|
if (connection.queueEntry) {
|
|
321
|
-
|
|
376
|
+
// a closed pool (a forced close ends a delivery on purpose) fails the
|
|
377
|
+
// message rather than queueing it for a retry that would never run
|
|
378
|
+
if (!this._closed && this._shouldRequeuOnConnectionClose(connection.queueEntry)) {
|
|
322
379
|
delay = this._requeueEntryOnConnectionClose(connection);
|
|
323
380
|
}
|
|
324
381
|
else {
|
|
@@ -380,6 +437,7 @@ class SMTPPool extends EventEmitter {
|
|
|
380
437
|
messageId: connection.queueEntry.messageId,
|
|
381
438
|
action: 'requeue'
|
|
382
439
|
}, 'Re-queued message <%s> for #%s. Attempt: #%s', connection.queueEntry.messageId, connection.id, connection.queueEntry.requeueAttempts);
|
|
440
|
+
connection.queueEntry.resource = undefined;
|
|
383
441
|
this._queue.unshift(connection.queueEntry);
|
|
384
442
|
connection.queueEntry = false;
|
|
385
443
|
return delay;
|
|
@@ -48,6 +48,7 @@ export default class PoolResource extends EventEmitter {
|
|
|
48
48
|
}
|
|
49
49
|
this._connection = false;
|
|
50
50
|
this._connected = false;
|
|
51
|
+
this._closed = false;
|
|
51
52
|
this.messages = 0;
|
|
52
53
|
this.available = true;
|
|
53
54
|
this._failed = false;
|
|
@@ -75,6 +76,10 @@ export default class PoolResource extends EventEmitter {
|
|
|
75
76
|
// the proxy handshake, if any, counts against connectionTimeout as well
|
|
76
77
|
const connectStartedAt = Date.now();
|
|
77
78
|
this.pool.getSocket(Object.assign({}, this.options, { connectStartedAt }), (err, socketOptions) => {
|
|
79
|
+
if (this._closed) {
|
|
80
|
+
socketOptions && socketOptions.connection?.destroy();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
78
83
|
if (err) {
|
|
79
84
|
// nothing was connected, so no 'close' event is coming that would free the
|
|
80
85
|
// slot this resource holds in the pool, report the failure the way a failed
|
|
@@ -98,7 +103,7 @@ export default class PoolResource extends EventEmitter {
|
|
|
98
103
|
this.connection = new SMTPConnection(options);
|
|
99
104
|
this.connection._connectStartedAt = connectStartedAt;
|
|
100
105
|
this.connection.on('error', (err) => {
|
|
101
|
-
if (this._sending) {
|
|
106
|
+
if (this._closed || this._sending) {
|
|
102
107
|
// the send callback gets the same error and decides what it means for the message
|
|
103
108
|
return;
|
|
104
109
|
}
|
|
@@ -112,7 +117,7 @@ export default class PoolResource extends EventEmitter {
|
|
|
112
117
|
return;
|
|
113
118
|
}
|
|
114
119
|
this._fail(err);
|
|
115
|
-
if (returned) {
|
|
120
|
+
if (returned || this._closed) {
|
|
116
121
|
return;
|
|
117
122
|
}
|
|
118
123
|
returned = true;
|
|
@@ -123,7 +128,7 @@ export default class PoolResource extends EventEmitter {
|
|
|
123
128
|
returned = true;
|
|
124
129
|
});
|
|
125
130
|
this.connection.connect(err => {
|
|
126
|
-
if (returned) {
|
|
131
|
+
if (returned || this._closed) {
|
|
127
132
|
return;
|
|
128
133
|
}
|
|
129
134
|
if (err) {
|
|
@@ -134,7 +139,7 @@ export default class PoolResource extends EventEmitter {
|
|
|
134
139
|
}
|
|
135
140
|
if (this.auth && (this.connection.allowsAuth || options.forceAuth)) {
|
|
136
141
|
this.connection.login(this.auth, err => {
|
|
137
|
-
if (returned) {
|
|
142
|
+
if (returned || this._closed) {
|
|
138
143
|
return;
|
|
139
144
|
}
|
|
140
145
|
returned = true;
|
|
@@ -162,6 +167,9 @@ export default class PoolResource extends EventEmitter {
|
|
|
162
167
|
* @param callback Callback function
|
|
163
168
|
*/
|
|
164
169
|
send(mail, callback) {
|
|
170
|
+
if (this._closed) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
165
173
|
if (!this._connected) {
|
|
166
174
|
return this.connect(err => {
|
|
167
175
|
if (err) {
|
|
@@ -193,6 +201,9 @@ export default class PoolResource extends EventEmitter {
|
|
|
193
201
|
const reused = this.messages > 0;
|
|
194
202
|
const messageStream = mail.message.createReadStream();
|
|
195
203
|
this.connection.send(envelope, messageStream, (err, info) => {
|
|
204
|
+
if (mail.data.signal?.aborted) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
196
207
|
this._sending = false;
|
|
197
208
|
this.messages++;
|
|
198
209
|
if (err) {
|
|
@@ -239,6 +250,9 @@ export default class PoolResource extends EventEmitter {
|
|
|
239
250
|
* @internal
|
|
240
251
|
*/
|
|
241
252
|
_release() {
|
|
253
|
+
if (this._closed) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
242
256
|
if (this.messages >= this.options.maxMessages) {
|
|
243
257
|
const err = new Error('Resource exhausted');
|
|
244
258
|
err.code = errors.EMAXLIMIT;
|
|
@@ -247,6 +261,9 @@ export default class PoolResource extends EventEmitter {
|
|
|
247
261
|
return;
|
|
248
262
|
}
|
|
249
263
|
this.pool._checkRateLimit(() => {
|
|
264
|
+
if (this._closed) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
250
267
|
this.available = true;
|
|
251
268
|
this._startIdleTimer();
|
|
252
269
|
this.emit('available');
|
|
@@ -289,6 +306,11 @@ export default class PoolResource extends EventEmitter {
|
|
|
289
306
|
* Closes the connection
|
|
290
307
|
*/
|
|
291
308
|
close() {
|
|
309
|
+
if (this._closed) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
this._closed = true;
|
|
313
|
+
this.available = false;
|
|
292
314
|
this._connected = false;
|
|
293
315
|
this._stopIdleTimer();
|
|
294
316
|
if (this.auth && this.auth.oauth2) {
|
|
@@ -93,6 +93,7 @@ export type SMTPTransportSendCallback = ResultCallback<SMTPSentMessageInfo>;
|
|
|
93
93
|
* @param options Connection options
|
|
94
94
|
*/
|
|
95
95
|
declare class SMTPTransport extends EventEmitter {
|
|
96
|
+
readonly supportsAbortSignal = true;
|
|
96
97
|
options: SMTPTransportOptions;
|
|
97
98
|
logger: shared.Logger;
|
|
98
99
|
name: string;
|
|
@@ -21,6 +21,7 @@ const MESSAGE_AUTH_KEYS = ['type', 'user', 'pass', 'accessToken', 'refreshToken'
|
|
|
21
21
|
class SMTPTransport extends EventEmitter {
|
|
22
22
|
constructor(options) {
|
|
23
23
|
super();
|
|
24
|
+
this.supportsAbortSignal = true;
|
|
24
25
|
options = options || {};
|
|
25
26
|
if (typeof options === 'string') {
|
|
26
27
|
options = {
|
|
@@ -115,13 +116,46 @@ class SMTPTransport extends EventEmitter {
|
|
|
115
116
|
* @param callback Callback function
|
|
116
117
|
*/
|
|
117
118
|
send(mail, callback) {
|
|
119
|
+
const signal = mail.data.signal;
|
|
120
|
+
let returned = false;
|
|
121
|
+
let connection;
|
|
122
|
+
let perCallAuth;
|
|
123
|
+
const cleanupPerCallAuth = () => {
|
|
124
|
+
if (perCallAuth && perCallAuth !== this.auth && perCallAuth.oauth2) {
|
|
125
|
+
perCallAuth.oauth2.removeAllListeners();
|
|
126
|
+
}
|
|
127
|
+
perCallAuth = null;
|
|
128
|
+
};
|
|
129
|
+
const finish = (err, info) => {
|
|
130
|
+
if (returned) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
returned = true;
|
|
134
|
+
signal?.removeEventListener('abort', onAbort);
|
|
135
|
+
cleanupPerCallAuth();
|
|
136
|
+
connection?.close();
|
|
137
|
+
callback(err, info);
|
|
138
|
+
};
|
|
139
|
+
function onAbort() {
|
|
140
|
+
finish(errors.createAbortError(signal));
|
|
141
|
+
}
|
|
142
|
+
if (signal) {
|
|
143
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
144
|
+
if (signal.aborted) {
|
|
145
|
+
setImmediate(onAbort);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
118
149
|
// the proxy handshake, if any, counts against connectionTimeout as well
|
|
119
150
|
const connectStartedAt = Date.now();
|
|
120
151
|
this.getSocket(Object.assign({}, this.options, { connectStartedAt }), (err, socketOptions) => {
|
|
152
|
+
if (returned) {
|
|
153
|
+
socketOptions && socketOptions.connection?.destroy();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
121
156
|
if (err) {
|
|
122
|
-
return
|
|
157
|
+
return finish(err);
|
|
123
158
|
}
|
|
124
|
-
let returned = false;
|
|
125
159
|
let options = this.options;
|
|
126
160
|
if (socketOptions && socketOptions.connection) {
|
|
127
161
|
this.logger.info({
|
|
@@ -135,24 +169,9 @@ class SMTPTransport extends EventEmitter {
|
|
|
135
169
|
// only copy options if we need to modify it
|
|
136
170
|
options = Object.assign(shared.assign(false, options), socketOptions);
|
|
137
171
|
}
|
|
138
|
-
const connection = new SMTPConnection(options);
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const cleanupPerCallAuth = () => {
|
|
142
|
-
if (perCallAuth && perCallAuth !== this.auth && perCallAuth.oauth2) {
|
|
143
|
-
perCallAuth.oauth2.removeAllListeners();
|
|
144
|
-
}
|
|
145
|
-
perCallAuth = null;
|
|
146
|
-
};
|
|
147
|
-
connection.once('error', err => {
|
|
148
|
-
if (returned) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
returned = true;
|
|
152
|
-
cleanupPerCallAuth();
|
|
153
|
-
connection.close();
|
|
154
|
-
return callback(err);
|
|
155
|
-
});
|
|
172
|
+
const smtp = (connection = new SMTPConnection(options));
|
|
173
|
+
smtp._connectStartedAt = connectStartedAt;
|
|
174
|
+
smtp.once('error', err => finish(err));
|
|
156
175
|
const sendMessage = () => {
|
|
157
176
|
const envelope = mail.message.getEnvelope();
|
|
158
177
|
const messageId = mail.message.messageId();
|
|
@@ -171,20 +190,17 @@ class SMTPTransport extends EventEmitter {
|
|
|
171
190
|
tnx: 'send',
|
|
172
191
|
messageId
|
|
173
192
|
}, 'Sending message %s to <%s>', messageId, recipients.join(', '));
|
|
174
|
-
|
|
193
|
+
smtp.send(envelope, mail.message.createReadStream(), (err, info) => {
|
|
175
194
|
if (returned) {
|
|
176
195
|
// the connection error handler has already reported this send
|
|
177
196
|
return;
|
|
178
197
|
}
|
|
179
|
-
returned = true;
|
|
180
|
-
cleanupPerCallAuth();
|
|
181
|
-
connection.close();
|
|
182
198
|
if (err) {
|
|
183
199
|
this.logger.error({
|
|
184
200
|
err,
|
|
185
201
|
tnx: 'send'
|
|
186
202
|
}, 'Send error for %s: %s', messageId, err.message);
|
|
187
|
-
return
|
|
203
|
+
return finish(err);
|
|
188
204
|
}
|
|
189
205
|
info.envelope = {
|
|
190
206
|
from: envelope.from,
|
|
@@ -192,7 +208,7 @@ class SMTPTransport extends EventEmitter {
|
|
|
192
208
|
};
|
|
193
209
|
info.messageId = messageId;
|
|
194
210
|
try {
|
|
195
|
-
return
|
|
211
|
+
return finish(null, info);
|
|
196
212
|
}
|
|
197
213
|
catch (E) {
|
|
198
214
|
this.logger.error({
|
|
@@ -202,27 +218,23 @@ class SMTPTransport extends EventEmitter {
|
|
|
202
218
|
}
|
|
203
219
|
});
|
|
204
220
|
};
|
|
205
|
-
|
|
221
|
+
smtp.connect(err => {
|
|
206
222
|
if (returned) {
|
|
207
223
|
return;
|
|
208
224
|
}
|
|
209
225
|
if (err) {
|
|
210
226
|
// the server closed the connection before the greeting
|
|
211
|
-
|
|
212
|
-
connection.close();
|
|
213
|
-
return callback(err);
|
|
227
|
+
return finish(err);
|
|
214
228
|
}
|
|
215
229
|
perCallAuth = this.getAuth(mail.data.auth);
|
|
216
|
-
if (perCallAuth && (
|
|
217
|
-
|
|
230
|
+
if (perCallAuth && (smtp.allowsAuth || options.forceAuth)) {
|
|
231
|
+
smtp.login(perCallAuth, err => {
|
|
218
232
|
cleanupPerCallAuth();
|
|
219
233
|
if (returned) {
|
|
220
234
|
return;
|
|
221
235
|
}
|
|
222
236
|
if (err) {
|
|
223
|
-
|
|
224
|
-
connection.close();
|
|
225
|
-
return callback(err);
|
|
237
|
+
return finish(err);
|
|
226
238
|
}
|
|
227
239
|
sendMessage();
|
|
228
240
|
});
|
|
@@ -606,6 +606,13 @@ export const services = {
|
|
|
606
606
|
"host": "mail.smtp2go.com",
|
|
607
607
|
"port": 2525
|
|
608
608
|
},
|
|
609
|
+
"SpacePost": {
|
|
610
|
+
"description": "SpacePost",
|
|
611
|
+
"host": "smtp.spacepost.dev",
|
|
612
|
+
"port": 25976,
|
|
613
|
+
"secure": false,
|
|
614
|
+
"requireTLS": true
|
|
615
|
+
},
|
|
609
616
|
"Sparkpost": {
|
|
610
617
|
"description": "SparkPost",
|
|
611
618
|
"aliases": [
|
|
@@ -585,6 +585,14 @@
|
|
|
585
585
|
"port": 2525
|
|
586
586
|
},
|
|
587
587
|
|
|
588
|
+
"SpacePost": {
|
|
589
|
+
"description": "SpacePost",
|
|
590
|
+
"host": "smtp.spacepost.dev",
|
|
591
|
+
"port": 25976,
|
|
592
|
+
"secure": false,
|
|
593
|
+
"requireTLS": true
|
|
594
|
+
},
|
|
595
|
+
|
|
588
596
|
"Sparkpost": {
|
|
589
597
|
"description": "SparkPost",
|
|
590
598
|
"aliases": ["SparkPost", "SparkPost Mail"],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodemailer",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.5.0",
|
|
4
4
|
"description": "Easy as cake e-mail sending from your Node.js applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/nodemailer.js",
|
|
@@ -153,24 +153,24 @@
|
|
|
153
153
|
},
|
|
154
154
|
"homepage": "https://nodemailer.com/",
|
|
155
155
|
"devDependencies": {
|
|
156
|
-
"@aws-sdk/client-sesv2": "3.
|
|
156
|
+
"@aws-sdk/client-sesv2": "3.1165.0",
|
|
157
157
|
"@types/node": "20.19.43",
|
|
158
158
|
"bunyan": "1.8.15",
|
|
159
159
|
"c8": "12.0.0",
|
|
160
|
-
"eslint": "10.
|
|
160
|
+
"eslint": "10.14.0",
|
|
161
161
|
"eslint-config-prettier": "10.1.8",
|
|
162
|
-
"globals": "17.
|
|
162
|
+
"globals": "17.14.0",
|
|
163
163
|
"libbase64": "1.4.1",
|
|
164
|
-
"libmime": "5.6.
|
|
164
|
+
"libmime": "5.6.4",
|
|
165
165
|
"libqp": "3.0.1",
|
|
166
166
|
"mailauth": "8.0.4",
|
|
167
167
|
"prettier": "3.9.10",
|
|
168
168
|
"proxy": "1.0.2",
|
|
169
169
|
"proxy-test-server": "1.0.0",
|
|
170
|
-
"smtp-server": "3.21.
|
|
170
|
+
"smtp-server": "3.21.3",
|
|
171
171
|
"tsx": "4.23.15",
|
|
172
172
|
"typescript": "6.0.3",
|
|
173
|
-
"typescript-eslint": "8.72.
|
|
173
|
+
"typescript-eslint": "8.72.2"
|
|
174
174
|
},
|
|
175
175
|
"engines": {
|
|
176
176
|
"node": ">=20.0.0"
|
package/package.json
CHANGED
|
@@ -79,15 +79,15 @@
|
|
|
79
79
|
"constructs": "^10.5.1"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@aws-sdk/client-cloudwatch-logs": "^3.
|
|
83
|
-
"@aws-sdk/client-route-53": "^3.
|
|
84
|
-
"@aws-sdk/client-s3": "^3.
|
|
85
|
-
"@aws-sdk/client-ses": "^3.
|
|
86
|
-
"@aws-sdk/client-ssm": "^3.
|
|
82
|
+
"@aws-sdk/client-cloudwatch-logs": "^3.1166.0",
|
|
83
|
+
"@aws-sdk/client-route-53": "^3.1166.0",
|
|
84
|
+
"@aws-sdk/client-s3": "^3.1166.0",
|
|
85
|
+
"@aws-sdk/client-ses": "^3.1166.0",
|
|
86
|
+
"@aws-sdk/client-ssm": "^3.1166.0",
|
|
87
87
|
"@mavogel/mvc-projen": "^0.0.75",
|
|
88
88
|
"cdk-nag": "^3.0.1",
|
|
89
89
|
"constructs": "^10.5.1",
|
|
90
|
-
"mailparser": "^3.14.
|
|
90
|
+
"mailparser": "^3.14.3",
|
|
91
91
|
"uuid": "^14.0.3"
|
|
92
92
|
},
|
|
93
93
|
"bundledDependencies": [
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"publishConfig": {
|
|
123
123
|
"access": "public"
|
|
124
124
|
},
|
|
125
|
-
"version": "0.1.
|
|
125
|
+
"version": "0.1.43",
|
|
126
126
|
"jest": {
|
|
127
127
|
"coverageProvider": "v8",
|
|
128
128
|
"transformIgnorePatterns": [
|