@upyo/smtp 0.1.0-dev.13 → 0.1.0-dev.17
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 +10 -2
- package/dist/index.cjs +26 -39
- package/dist/index.d.cts +12 -69
- package/dist/index.d.ts +12 -69
- package/dist/index.js +26 -38
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -77,7 +77,11 @@ const message = createMessage({
|
|
|
77
77
|
});
|
|
78
78
|
|
|
79
79
|
const receipt = await transport.send(message);
|
|
80
|
-
|
|
80
|
+
if (receipt.successful) {
|
|
81
|
+
console.log("Message sent with ID:", receipt.messageId);
|
|
82
|
+
} else {
|
|
83
|
+
console.error("Send failed:", receipt.errorMessages.join(", "));
|
|
84
|
+
}
|
|
81
85
|
~~~~
|
|
82
86
|
|
|
83
87
|
### Sending Multiple Emails
|
|
@@ -86,7 +90,11 @@ console.log("Email sent:", receipt.successful);
|
|
|
86
90
|
const messages = [message1, message2, message3];
|
|
87
91
|
|
|
88
92
|
for await (const receipt of transport.sendMany(messages)) {
|
|
89
|
-
|
|
93
|
+
if (receipt.successful) {
|
|
94
|
+
console.log(`Email sent with ID: ${receipt.messageId}`);
|
|
95
|
+
} else {
|
|
96
|
+
console.error(`Email failed: ${receipt.errorMessages.join(", ")}`);
|
|
97
|
+
}
|
|
90
98
|
}
|
|
91
99
|
~~~~
|
|
92
100
|
|
package/dist/index.cjs
CHANGED
|
@@ -31,21 +31,11 @@ const __upyo_core = __toESM(require("@upyo/core"));
|
|
|
31
31
|
*
|
|
32
32
|
* This function takes a partial SMTP configuration and returns a complete
|
|
33
33
|
* configuration with all optional fields filled with sensible defaults.
|
|
34
|
+
* It is used internally by the SMTP transport.
|
|
34
35
|
*
|
|
35
36
|
* @param config - The SMTP configuration with optional fields
|
|
36
37
|
* @returns A resolved configuration with all defaults applied
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```typescript
|
|
40
|
-
* const resolved = createSmtpConfig({
|
|
41
|
-
* host: 'smtp.example.com',
|
|
42
|
-
* auth: { user: 'user', pass: 'pass' }
|
|
43
|
-
* });
|
|
44
|
-
*
|
|
45
|
-
* // resolved.port will be 587 (default)
|
|
46
|
-
* // resolved.secure will be true (default)
|
|
47
|
-
* // resolved.poolSize will be 5 (default)
|
|
48
|
-
* ```
|
|
38
|
+
* @internal
|
|
49
39
|
*/
|
|
50
40
|
function createSmtpConfig(config) {
|
|
51
41
|
return {
|
|
@@ -428,9 +418,15 @@ function encodeBase64(data) {
|
|
|
428
418
|
* ```
|
|
429
419
|
*/
|
|
430
420
|
var SmtpTransport = class {
|
|
421
|
+
/**
|
|
422
|
+
* The SMTP configuration used by this transport.
|
|
423
|
+
*/
|
|
431
424
|
config;
|
|
432
|
-
|
|
425
|
+
/**
|
|
426
|
+
* The maximum number of connections in the pool.
|
|
427
|
+
*/
|
|
433
428
|
poolSize;
|
|
429
|
+
connectionPool = [];
|
|
434
430
|
/**
|
|
435
431
|
* Creates a new SMTP transport instance.
|
|
436
432
|
*
|
|
@@ -477,16 +473,14 @@ var SmtpTransport = class {
|
|
|
477
473
|
const messageId = await connection.sendMessage(smtpMessage, options?.signal);
|
|
478
474
|
await this.returnConnection(connection);
|
|
479
475
|
return {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
successful: true
|
|
476
|
+
successful: true,
|
|
477
|
+
messageId
|
|
483
478
|
};
|
|
484
479
|
} catch (error) {
|
|
485
480
|
await this.discardConnection(connection);
|
|
486
481
|
return {
|
|
487
|
-
|
|
488
|
-
errorMessages: [error instanceof Error ? error.message : String(error)]
|
|
489
|
-
successful: false
|
|
482
|
+
successful: false,
|
|
483
|
+
errorMessages: [error instanceof Error ? error.message : String(error)]
|
|
490
484
|
};
|
|
491
485
|
}
|
|
492
486
|
}
|
|
@@ -528,9 +522,8 @@ var SmtpTransport = class {
|
|
|
528
522
|
options?.signal?.throwIfAborted();
|
|
529
523
|
if (!connectionValid) {
|
|
530
524
|
yield {
|
|
531
|
-
|
|
532
|
-
errorMessages: ["Connection is no longer valid"]
|
|
533
|
-
successful: false
|
|
525
|
+
successful: false,
|
|
526
|
+
errorMessages: ["Connection is no longer valid"]
|
|
534
527
|
};
|
|
535
528
|
continue;
|
|
536
529
|
}
|
|
@@ -539,16 +532,14 @@ var SmtpTransport = class {
|
|
|
539
532
|
options?.signal?.throwIfAborted();
|
|
540
533
|
const messageId = await connection.sendMessage(smtpMessage, options?.signal);
|
|
541
534
|
yield {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
successful: true
|
|
535
|
+
successful: true,
|
|
536
|
+
messageId
|
|
545
537
|
};
|
|
546
538
|
} catch (error) {
|
|
547
539
|
connectionValid = false;
|
|
548
540
|
yield {
|
|
549
|
-
|
|
550
|
-
errorMessages: [error instanceof Error ? error.message : String(error)]
|
|
551
|
-
successful: false
|
|
541
|
+
successful: false,
|
|
542
|
+
errorMessages: [error instanceof Error ? error.message : String(error)]
|
|
552
543
|
};
|
|
553
544
|
}
|
|
554
545
|
}
|
|
@@ -556,9 +547,8 @@ var SmtpTransport = class {
|
|
|
556
547
|
options?.signal?.throwIfAborted();
|
|
557
548
|
if (!connectionValid) {
|
|
558
549
|
yield {
|
|
559
|
-
|
|
560
|
-
errorMessages: ["Connection is no longer valid"]
|
|
561
|
-
successful: false
|
|
550
|
+
successful: false,
|
|
551
|
+
errorMessages: ["Connection is no longer valid"]
|
|
562
552
|
};
|
|
563
553
|
continue;
|
|
564
554
|
}
|
|
@@ -567,16 +557,14 @@ var SmtpTransport = class {
|
|
|
567
557
|
options?.signal?.throwIfAborted();
|
|
568
558
|
const messageId = await connection.sendMessage(smtpMessage, options?.signal);
|
|
569
559
|
yield {
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
successful: true
|
|
560
|
+
successful: true,
|
|
561
|
+
messageId
|
|
573
562
|
};
|
|
574
563
|
} catch (error) {
|
|
575
564
|
connectionValid = false;
|
|
576
565
|
yield {
|
|
577
|
-
|
|
578
|
-
errorMessages: [error instanceof Error ? error.message : String(error)]
|
|
579
|
-
successful: false
|
|
566
|
+
successful: false,
|
|
567
|
+
errorMessages: [error instanceof Error ? error.message : String(error)]
|
|
580
568
|
};
|
|
581
569
|
}
|
|
582
570
|
}
|
|
@@ -661,5 +649,4 @@ var SmtpTransport = class {
|
|
|
661
649
|
};
|
|
662
650
|
|
|
663
651
|
//#endregion
|
|
664
|
-
exports.SmtpTransport = SmtpTransport;
|
|
665
|
-
exports.createSmtpConfig = createSmtpConfig;
|
|
652
|
+
exports.SmtpTransport = SmtpTransport;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Message, Receipt, Transport, TransportOptions } from "@upyo/core";
|
|
2
|
-
import { Socket } from "node:net";
|
|
3
|
-
import { TLSSocket } from "node:tls";
|
|
4
2
|
|
|
5
3
|
//#region src/config.d.ts
|
|
6
4
|
|
|
@@ -154,67 +152,6 @@ interface SmtpTlsOptions {
|
|
|
154
152
|
* This type represents the final configuration after applying defaults,
|
|
155
153
|
* used internally by the SMTP transport implementation.
|
|
156
154
|
*/
|
|
157
|
-
type ResolvedSmtpConfig = Omit<Required<SmtpConfig>, "auth" | "tls"> & {
|
|
158
|
-
readonly auth?: SmtpAuth;
|
|
159
|
-
readonly tls?: SmtpTlsOptions;
|
|
160
|
-
};
|
|
161
|
-
/**
|
|
162
|
-
* Creates a resolved SMTP configuration by applying default values to optional fields.
|
|
163
|
-
*
|
|
164
|
-
* This function takes a partial SMTP configuration and returns a complete
|
|
165
|
-
* configuration with all optional fields filled with sensible defaults.
|
|
166
|
-
*
|
|
167
|
-
* @param config - The SMTP configuration with optional fields
|
|
168
|
-
* @returns A resolved configuration with all defaults applied
|
|
169
|
-
*
|
|
170
|
-
* @example
|
|
171
|
-
* ```typescript
|
|
172
|
-
* const resolved = createSmtpConfig({
|
|
173
|
-
* host: 'smtp.example.com',
|
|
174
|
-
* auth: { user: 'user', pass: 'pass' }
|
|
175
|
-
* });
|
|
176
|
-
*
|
|
177
|
-
* // resolved.port will be 587 (default)
|
|
178
|
-
* // resolved.secure will be true (default)
|
|
179
|
-
* // resolved.poolSize will be 5 (default)
|
|
180
|
-
* ```
|
|
181
|
-
*/
|
|
182
|
-
declare function createSmtpConfig(config: SmtpConfig): ResolvedSmtpConfig;
|
|
183
|
-
//#endregion
|
|
184
|
-
//#region src/message-converter.d.ts
|
|
185
|
-
interface SmtpMessage {
|
|
186
|
-
readonly envelope: SmtpEnvelope;
|
|
187
|
-
readonly raw: string;
|
|
188
|
-
}
|
|
189
|
-
interface SmtpEnvelope {
|
|
190
|
-
readonly from: string;
|
|
191
|
-
readonly to: string[];
|
|
192
|
-
}
|
|
193
|
-
//#endregion
|
|
194
|
-
//#region src/smtp-connection.d.ts
|
|
195
|
-
declare class SmtpConnection {
|
|
196
|
-
socket: Socket | TLSSocket | null;
|
|
197
|
-
config: ResolvedSmtpConfig;
|
|
198
|
-
authenticated: boolean;
|
|
199
|
-
capabilities: string[];
|
|
200
|
-
constructor(config: SmtpConfig);
|
|
201
|
-
connect(signal?: AbortSignal): Promise<void>;
|
|
202
|
-
sendCommand(command: string, signal?: AbortSignal): Promise<SmtpResponse>;
|
|
203
|
-
greeting(signal?: AbortSignal): Promise<SmtpResponse>;
|
|
204
|
-
ehlo(signal?: AbortSignal): Promise<void>;
|
|
205
|
-
authenticate(signal?: AbortSignal): Promise<void>;
|
|
206
|
-
private authPlain;
|
|
207
|
-
authLogin(signal?: AbortSignal): Promise<void>;
|
|
208
|
-
sendMessage(message: SmtpMessage, signal?: AbortSignal): Promise<string>;
|
|
209
|
-
extractMessageId(response: string): string;
|
|
210
|
-
quit(): Promise<void>;
|
|
211
|
-
reset(signal?: AbortSignal): Promise<void>;
|
|
212
|
-
}
|
|
213
|
-
interface SmtpResponse {
|
|
214
|
-
readonly code: number;
|
|
215
|
-
readonly message: string;
|
|
216
|
-
readonly raw: string;
|
|
217
|
-
}
|
|
218
155
|
//#endregion
|
|
219
156
|
//#region src/smtp-transport.d.ts
|
|
220
157
|
/**
|
|
@@ -251,9 +188,15 @@ interface SmtpResponse {
|
|
|
251
188
|
* ```
|
|
252
189
|
*/
|
|
253
190
|
declare class SmtpTransport implements Transport, AsyncDisposable {
|
|
191
|
+
/**
|
|
192
|
+
* The SMTP configuration used by this transport.
|
|
193
|
+
*/
|
|
254
194
|
config: SmtpConfig;
|
|
255
|
-
|
|
195
|
+
/**
|
|
196
|
+
* The maximum number of connections in the pool.
|
|
197
|
+
*/
|
|
256
198
|
poolSize: number;
|
|
199
|
+
private connectionPool;
|
|
257
200
|
/**
|
|
258
201
|
* Creates a new SMTP transport instance.
|
|
259
202
|
*
|
|
@@ -317,10 +260,10 @@ declare class SmtpTransport implements Transport, AsyncDisposable {
|
|
|
317
260
|
* @returns An async iterable of receipts, one for each message.
|
|
318
261
|
*/
|
|
319
262
|
sendMany(messages: Iterable<Message> | AsyncIterable<Message>, options?: TransportOptions): AsyncIterable<Receipt>;
|
|
320
|
-
getConnection
|
|
321
|
-
connectAndSetup
|
|
322
|
-
returnConnection
|
|
323
|
-
discardConnection
|
|
263
|
+
private getConnection;
|
|
264
|
+
private connectAndSetup;
|
|
265
|
+
private returnConnection;
|
|
266
|
+
private discardConnection;
|
|
324
267
|
/**
|
|
325
268
|
* Closes all active SMTP connections in the connection pool.
|
|
326
269
|
*
|
|
@@ -352,4 +295,4 @@ declare class SmtpTransport implements Transport, AsyncDisposable {
|
|
|
352
295
|
[Symbol.asyncDispose](): Promise<void>;
|
|
353
296
|
}
|
|
354
297
|
//#endregion
|
|
355
|
-
export { SmtpAuth, SmtpConfig, SmtpTlsOptions, SmtpTransport
|
|
298
|
+
export { SmtpAuth, SmtpConfig, SmtpTlsOptions, SmtpTransport };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Socket } from "node:net";
|
|
2
|
-
import { TLSSocket } from "node:tls";
|
|
3
1
|
import { Message, Receipt, Transport, TransportOptions } from "@upyo/core";
|
|
4
2
|
|
|
5
3
|
//#region src/config.d.ts
|
|
@@ -154,67 +152,6 @@ interface SmtpTlsOptions {
|
|
|
154
152
|
* This type represents the final configuration after applying defaults,
|
|
155
153
|
* used internally by the SMTP transport implementation.
|
|
156
154
|
*/
|
|
157
|
-
type ResolvedSmtpConfig = Omit<Required<SmtpConfig>, "auth" | "tls"> & {
|
|
158
|
-
readonly auth?: SmtpAuth;
|
|
159
|
-
readonly tls?: SmtpTlsOptions;
|
|
160
|
-
};
|
|
161
|
-
/**
|
|
162
|
-
* Creates a resolved SMTP configuration by applying default values to optional fields.
|
|
163
|
-
*
|
|
164
|
-
* This function takes a partial SMTP configuration and returns a complete
|
|
165
|
-
* configuration with all optional fields filled with sensible defaults.
|
|
166
|
-
*
|
|
167
|
-
* @param config - The SMTP configuration with optional fields
|
|
168
|
-
* @returns A resolved configuration with all defaults applied
|
|
169
|
-
*
|
|
170
|
-
* @example
|
|
171
|
-
* ```typescript
|
|
172
|
-
* const resolved = createSmtpConfig({
|
|
173
|
-
* host: 'smtp.example.com',
|
|
174
|
-
* auth: { user: 'user', pass: 'pass' }
|
|
175
|
-
* });
|
|
176
|
-
*
|
|
177
|
-
* // resolved.port will be 587 (default)
|
|
178
|
-
* // resolved.secure will be true (default)
|
|
179
|
-
* // resolved.poolSize will be 5 (default)
|
|
180
|
-
* ```
|
|
181
|
-
*/
|
|
182
|
-
declare function createSmtpConfig(config: SmtpConfig): ResolvedSmtpConfig;
|
|
183
|
-
//#endregion
|
|
184
|
-
//#region src/message-converter.d.ts
|
|
185
|
-
interface SmtpMessage {
|
|
186
|
-
readonly envelope: SmtpEnvelope;
|
|
187
|
-
readonly raw: string;
|
|
188
|
-
}
|
|
189
|
-
interface SmtpEnvelope {
|
|
190
|
-
readonly from: string;
|
|
191
|
-
readonly to: string[];
|
|
192
|
-
}
|
|
193
|
-
//#endregion
|
|
194
|
-
//#region src/smtp-connection.d.ts
|
|
195
|
-
declare class SmtpConnection {
|
|
196
|
-
socket: Socket | TLSSocket | null;
|
|
197
|
-
config: ResolvedSmtpConfig;
|
|
198
|
-
authenticated: boolean;
|
|
199
|
-
capabilities: string[];
|
|
200
|
-
constructor(config: SmtpConfig);
|
|
201
|
-
connect(signal?: AbortSignal): Promise<void>;
|
|
202
|
-
sendCommand(command: string, signal?: AbortSignal): Promise<SmtpResponse>;
|
|
203
|
-
greeting(signal?: AbortSignal): Promise<SmtpResponse>;
|
|
204
|
-
ehlo(signal?: AbortSignal): Promise<void>;
|
|
205
|
-
authenticate(signal?: AbortSignal): Promise<void>;
|
|
206
|
-
private authPlain;
|
|
207
|
-
authLogin(signal?: AbortSignal): Promise<void>;
|
|
208
|
-
sendMessage(message: SmtpMessage, signal?: AbortSignal): Promise<string>;
|
|
209
|
-
extractMessageId(response: string): string;
|
|
210
|
-
quit(): Promise<void>;
|
|
211
|
-
reset(signal?: AbortSignal): Promise<void>;
|
|
212
|
-
}
|
|
213
|
-
interface SmtpResponse {
|
|
214
|
-
readonly code: number;
|
|
215
|
-
readonly message: string;
|
|
216
|
-
readonly raw: string;
|
|
217
|
-
}
|
|
218
155
|
//#endregion
|
|
219
156
|
//#region src/smtp-transport.d.ts
|
|
220
157
|
/**
|
|
@@ -251,9 +188,15 @@ interface SmtpResponse {
|
|
|
251
188
|
* ```
|
|
252
189
|
*/
|
|
253
190
|
declare class SmtpTransport implements Transport, AsyncDisposable {
|
|
191
|
+
/**
|
|
192
|
+
* The SMTP configuration used by this transport.
|
|
193
|
+
*/
|
|
254
194
|
config: SmtpConfig;
|
|
255
|
-
|
|
195
|
+
/**
|
|
196
|
+
* The maximum number of connections in the pool.
|
|
197
|
+
*/
|
|
256
198
|
poolSize: number;
|
|
199
|
+
private connectionPool;
|
|
257
200
|
/**
|
|
258
201
|
* Creates a new SMTP transport instance.
|
|
259
202
|
*
|
|
@@ -317,10 +260,10 @@ declare class SmtpTransport implements Transport, AsyncDisposable {
|
|
|
317
260
|
* @returns An async iterable of receipts, one for each message.
|
|
318
261
|
*/
|
|
319
262
|
sendMany(messages: Iterable<Message> | AsyncIterable<Message>, options?: TransportOptions): AsyncIterable<Receipt>;
|
|
320
|
-
getConnection
|
|
321
|
-
connectAndSetup
|
|
322
|
-
returnConnection
|
|
323
|
-
discardConnection
|
|
263
|
+
private getConnection;
|
|
264
|
+
private connectAndSetup;
|
|
265
|
+
private returnConnection;
|
|
266
|
+
private discardConnection;
|
|
324
267
|
/**
|
|
325
268
|
* Closes all active SMTP connections in the connection pool.
|
|
326
269
|
*
|
|
@@ -352,4 +295,4 @@ declare class SmtpTransport implements Transport, AsyncDisposable {
|
|
|
352
295
|
[Symbol.asyncDispose](): Promise<void>;
|
|
353
296
|
}
|
|
354
297
|
//#endregion
|
|
355
|
-
export { SmtpAuth, SmtpConfig, SmtpTlsOptions, SmtpTransport
|
|
298
|
+
export { SmtpAuth, SmtpConfig, SmtpTlsOptions, SmtpTransport };
|
package/dist/index.js
CHANGED
|
@@ -8,21 +8,11 @@ import { formatAddress } from "@upyo/core";
|
|
|
8
8
|
*
|
|
9
9
|
* This function takes a partial SMTP configuration and returns a complete
|
|
10
10
|
* configuration with all optional fields filled with sensible defaults.
|
|
11
|
+
* It is used internally by the SMTP transport.
|
|
11
12
|
*
|
|
12
13
|
* @param config - The SMTP configuration with optional fields
|
|
13
14
|
* @returns A resolved configuration with all defaults applied
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* const resolved = createSmtpConfig({
|
|
18
|
-
* host: 'smtp.example.com',
|
|
19
|
-
* auth: { user: 'user', pass: 'pass' }
|
|
20
|
-
* });
|
|
21
|
-
*
|
|
22
|
-
* // resolved.port will be 587 (default)
|
|
23
|
-
* // resolved.secure will be true (default)
|
|
24
|
-
* // resolved.poolSize will be 5 (default)
|
|
25
|
-
* ```
|
|
15
|
+
* @internal
|
|
26
16
|
*/
|
|
27
17
|
function createSmtpConfig(config) {
|
|
28
18
|
return {
|
|
@@ -405,9 +395,15 @@ function encodeBase64(data) {
|
|
|
405
395
|
* ```
|
|
406
396
|
*/
|
|
407
397
|
var SmtpTransport = class {
|
|
398
|
+
/**
|
|
399
|
+
* The SMTP configuration used by this transport.
|
|
400
|
+
*/
|
|
408
401
|
config;
|
|
409
|
-
|
|
402
|
+
/**
|
|
403
|
+
* The maximum number of connections in the pool.
|
|
404
|
+
*/
|
|
410
405
|
poolSize;
|
|
406
|
+
connectionPool = [];
|
|
411
407
|
/**
|
|
412
408
|
* Creates a new SMTP transport instance.
|
|
413
409
|
*
|
|
@@ -454,16 +450,14 @@ var SmtpTransport = class {
|
|
|
454
450
|
const messageId = await connection.sendMessage(smtpMessage, options?.signal);
|
|
455
451
|
await this.returnConnection(connection);
|
|
456
452
|
return {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
successful: true
|
|
453
|
+
successful: true,
|
|
454
|
+
messageId
|
|
460
455
|
};
|
|
461
456
|
} catch (error) {
|
|
462
457
|
await this.discardConnection(connection);
|
|
463
458
|
return {
|
|
464
|
-
|
|
465
|
-
errorMessages: [error instanceof Error ? error.message : String(error)]
|
|
466
|
-
successful: false
|
|
459
|
+
successful: false,
|
|
460
|
+
errorMessages: [error instanceof Error ? error.message : String(error)]
|
|
467
461
|
};
|
|
468
462
|
}
|
|
469
463
|
}
|
|
@@ -505,9 +499,8 @@ var SmtpTransport = class {
|
|
|
505
499
|
options?.signal?.throwIfAborted();
|
|
506
500
|
if (!connectionValid) {
|
|
507
501
|
yield {
|
|
508
|
-
|
|
509
|
-
errorMessages: ["Connection is no longer valid"]
|
|
510
|
-
successful: false
|
|
502
|
+
successful: false,
|
|
503
|
+
errorMessages: ["Connection is no longer valid"]
|
|
511
504
|
};
|
|
512
505
|
continue;
|
|
513
506
|
}
|
|
@@ -516,16 +509,14 @@ var SmtpTransport = class {
|
|
|
516
509
|
options?.signal?.throwIfAborted();
|
|
517
510
|
const messageId = await connection.sendMessage(smtpMessage, options?.signal);
|
|
518
511
|
yield {
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
successful: true
|
|
512
|
+
successful: true,
|
|
513
|
+
messageId
|
|
522
514
|
};
|
|
523
515
|
} catch (error) {
|
|
524
516
|
connectionValid = false;
|
|
525
517
|
yield {
|
|
526
|
-
|
|
527
|
-
errorMessages: [error instanceof Error ? error.message : String(error)]
|
|
528
|
-
successful: false
|
|
518
|
+
successful: false,
|
|
519
|
+
errorMessages: [error instanceof Error ? error.message : String(error)]
|
|
529
520
|
};
|
|
530
521
|
}
|
|
531
522
|
}
|
|
@@ -533,9 +524,8 @@ var SmtpTransport = class {
|
|
|
533
524
|
options?.signal?.throwIfAborted();
|
|
534
525
|
if (!connectionValid) {
|
|
535
526
|
yield {
|
|
536
|
-
|
|
537
|
-
errorMessages: ["Connection is no longer valid"]
|
|
538
|
-
successful: false
|
|
527
|
+
successful: false,
|
|
528
|
+
errorMessages: ["Connection is no longer valid"]
|
|
539
529
|
};
|
|
540
530
|
continue;
|
|
541
531
|
}
|
|
@@ -544,16 +534,14 @@ var SmtpTransport = class {
|
|
|
544
534
|
options?.signal?.throwIfAborted();
|
|
545
535
|
const messageId = await connection.sendMessage(smtpMessage, options?.signal);
|
|
546
536
|
yield {
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
successful: true
|
|
537
|
+
successful: true,
|
|
538
|
+
messageId
|
|
550
539
|
};
|
|
551
540
|
} catch (error) {
|
|
552
541
|
connectionValid = false;
|
|
553
542
|
yield {
|
|
554
|
-
|
|
555
|
-
errorMessages: [error instanceof Error ? error.message : String(error)]
|
|
556
|
-
successful: false
|
|
543
|
+
successful: false,
|
|
544
|
+
errorMessages: [error instanceof Error ? error.message : String(error)]
|
|
557
545
|
};
|
|
558
546
|
}
|
|
559
547
|
}
|
|
@@ -638,4 +626,4 @@ var SmtpTransport = class {
|
|
|
638
626
|
};
|
|
639
627
|
|
|
640
628
|
//#endregion
|
|
641
|
-
export { SmtpTransport
|
|
629
|
+
export { SmtpTransport };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@upyo/smtp",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.17+3ffd074a",
|
|
4
4
|
"description": "SMTP transport for Upyo email library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"email",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"sideEffects": false,
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@upyo/core": "0.1.0-dev.
|
|
56
|
+
"@upyo/core": "0.1.0-dev.17+3ffd074a"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@dotenvx/dotenvx": "^1.47.3",
|