@sibiltech/sibil-mail 1.0.0
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/LICENSE +3 -0
- package/README.md +2 -0
- package/dist/errors/sibil-mail-error.d.ts +41 -0
- package/dist/errors/sibil-mail-error.d.ts.map +1 -0
- package/dist/errors/sibil-mail-error.js +64 -0
- package/dist/errors/sibil-mail-error.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/sibil-mail.d.ts +123 -0
- package/dist/sibil-mail.d.ts.map +1 -0
- package/dist/sibil-mail.js +286 -0
- package/dist/sibil-mail.js.map +1 -0
- package/dist/test-connection-simple.d.ts +8 -0
- package/dist/test-connection-simple.d.ts.map +1 -0
- package/dist/test-connection-simple.js +96 -0
- package/dist/test-connection-simple.js.map +1 -0
- package/dist/test-email.d.ts +9 -0
- package/dist/test-email.d.ts.map +1 -0
- package/dist/test-email.js +124 -0
- package/dist/test-email.js.map +1 -0
- package/dist/test-server.d.ts +9 -0
- package/dist/test-server.d.ts.map +1 -0
- package/dist/test-server.js +140 -0
- package/dist/test-server.js.map +1 -0
- package/dist/transport.d.ts +37 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +194 -0
- package/dist/transport.js.map +1 -0
- package/dist/types.d.ts +64 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/email-validator.d.ts +51 -0
- package/dist/utils/email-validator.d.ts.map +1 -0
- package/dist/utils/email-validator.js +74 -0
- package/dist/utils/email-validator.js.map +1 -0
- package/dist/utils/template-engine.d.ts +51 -0
- package/dist/utils/template-engine.d.ts.map +1 -0
- package/dist/utils/template-engine.js +102 -0
- package/dist/utils/template-engine.js.map +1 -0
- package/package.json +41 -0
package/LICENSE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SibilMail Error Classes
|
|
3
|
+
*
|
|
4
|
+
* Custom error classes for better error handling.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* SibilMailError
|
|
8
|
+
*
|
|
9
|
+
* Base error class for all SibilMail errors.
|
|
10
|
+
*/
|
|
11
|
+
export declare class SibilMailError extends Error {
|
|
12
|
+
code?: string | undefined;
|
|
13
|
+
constructor(message: string, code?: string | undefined);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* SmtpConnectionError
|
|
17
|
+
*
|
|
18
|
+
* Error thrown when SMTP connection fails.
|
|
19
|
+
*/
|
|
20
|
+
export declare class SmtpConnectionError extends SibilMailError {
|
|
21
|
+
constructor(message: string);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* EmailValidationError
|
|
25
|
+
*
|
|
26
|
+
* Error thrown when email validation fails.
|
|
27
|
+
*/
|
|
28
|
+
export declare class EmailValidationError extends SibilMailError {
|
|
29
|
+
invalidEmails?: string[] | undefined;
|
|
30
|
+
constructor(message: string, invalidEmails?: string[] | undefined);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* EmailSendError
|
|
34
|
+
*
|
|
35
|
+
* Error thrown when email sending fails.
|
|
36
|
+
*/
|
|
37
|
+
export declare class EmailSendError extends SibilMailError {
|
|
38
|
+
originalError?: Error | undefined;
|
|
39
|
+
constructor(message: string, originalError?: Error | undefined);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=sibil-mail-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sibil-mail-error.d.ts","sourceRoot":"","sources":["../../src/errors/sibil-mail-error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACH,IAAI,CAAC,EAAE,MAAM;gBAArC,OAAO,EAAE,MAAM,EAAS,IAAI,CAAC,EAAE,MAAM,YAAA;CAKlD;AAED;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,cAAc;gBACzC,OAAO,EAAE,MAAM;CAK5B;AAED;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,cAAc;IAClB,aAAa,CAAC,EAAE,MAAM,EAAE;gBAAhD,OAAO,EAAE,MAAM,EAAS,aAAa,CAAC,EAAE,MAAM,EAAE,YAAA;CAK7D;AAED;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,cAAc;IACZ,aAAa,CAAC,EAAE,KAAK;gBAA7C,OAAO,EAAE,MAAM,EAAS,aAAa,CAAC,EAAE,KAAK,YAAA;CAK1D"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* SibilMail Error Classes
|
|
4
|
+
*
|
|
5
|
+
* Custom error classes for better error handling.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.EmailSendError = exports.EmailValidationError = exports.SmtpConnectionError = exports.SibilMailError = void 0;
|
|
9
|
+
/**
|
|
10
|
+
* SibilMailError
|
|
11
|
+
*
|
|
12
|
+
* Base error class for all SibilMail errors.
|
|
13
|
+
*/
|
|
14
|
+
class SibilMailError extends Error {
|
|
15
|
+
constructor(message, code) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.code = code;
|
|
18
|
+
this.name = 'SibilMailError';
|
|
19
|
+
Object.setPrototypeOf(this, SibilMailError.prototype);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.SibilMailError = SibilMailError;
|
|
23
|
+
/**
|
|
24
|
+
* SmtpConnectionError
|
|
25
|
+
*
|
|
26
|
+
* Error thrown when SMTP connection fails.
|
|
27
|
+
*/
|
|
28
|
+
class SmtpConnectionError extends SibilMailError {
|
|
29
|
+
constructor(message) {
|
|
30
|
+
super(message, 'SMTP_CONNECTION_ERROR');
|
|
31
|
+
this.name = 'SmtpConnectionError';
|
|
32
|
+
Object.setPrototypeOf(this, SmtpConnectionError.prototype);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.SmtpConnectionError = SmtpConnectionError;
|
|
36
|
+
/**
|
|
37
|
+
* EmailValidationError
|
|
38
|
+
*
|
|
39
|
+
* Error thrown when email validation fails.
|
|
40
|
+
*/
|
|
41
|
+
class EmailValidationError extends SibilMailError {
|
|
42
|
+
constructor(message, invalidEmails) {
|
|
43
|
+
super(message, 'EMAIL_VALIDATION_ERROR');
|
|
44
|
+
this.invalidEmails = invalidEmails;
|
|
45
|
+
this.name = 'EmailValidationError';
|
|
46
|
+
Object.setPrototypeOf(this, EmailValidationError.prototype);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.EmailValidationError = EmailValidationError;
|
|
50
|
+
/**
|
|
51
|
+
* EmailSendError
|
|
52
|
+
*
|
|
53
|
+
* Error thrown when email sending fails.
|
|
54
|
+
*/
|
|
55
|
+
class EmailSendError extends SibilMailError {
|
|
56
|
+
constructor(message, originalError) {
|
|
57
|
+
super(message, 'EMAIL_SEND_ERROR');
|
|
58
|
+
this.originalError = originalError;
|
|
59
|
+
this.name = 'EmailSendError';
|
|
60
|
+
Object.setPrototypeOf(this, EmailSendError.prototype);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.EmailSendError = EmailSendError;
|
|
64
|
+
//# sourceMappingURL=sibil-mail-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sibil-mail-error.js","sourceRoot":"","sources":["../../src/errors/sibil-mail-error.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;;;GAIG;AACH,MAAa,cAAe,SAAQ,KAAK;IACvC,YAAY,OAAe,EAAS,IAAa;QAC/C,KAAK,CAAC,OAAO,CAAC,CAAC;QADmB,SAAI,GAAJ,IAAI,CAAS;QAE/C,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACxD,CAAC;CACF;AAND,wCAMC;AAED;;;;GAIG;AACH,MAAa,mBAAoB,SAAQ,cAAc;IACrD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,uBAAuB,CAAC,CAAC;QACxC,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC7D,CAAC;CACF;AAND,kDAMC;AAED;;;;GAIG;AACH,MAAa,oBAAqB,SAAQ,cAAc;IACtD,YAAY,OAAe,EAAS,aAAwB;QAC1D,KAAK,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAAC;QADP,kBAAa,GAAb,aAAa,CAAW;QAE1D,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAC9D,CAAC;CACF;AAND,oDAMC;AAED;;;;GAIG;AACH,MAAa,cAAe,SAAQ,cAAc;IAChD,YAAY,OAAe,EAAS,aAAqB;QACvD,KAAK,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;QADD,kBAAa,GAAb,aAAa,CAAQ;QAEvD,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACxD,CAAC;CACF;AAND,wCAMC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sibil Mail - SMTP Email Sending Library
|
|
3
|
+
*
|
|
4
|
+
* Main entry point for the email library.
|
|
5
|
+
* Exports all public APIs for sending emails via SMTP.
|
|
6
|
+
*/
|
|
7
|
+
export { SibilMail } from './sibil-mail';
|
|
8
|
+
export { EmailOptions, EmailResult, SmtpConfig, EmailAttachment, TransportFactory, } from './types';
|
|
9
|
+
export { createSmtpTransport, verifySmtpConnection, closeTransport } from './transport';
|
|
10
|
+
export { isValidEmail, validateEmails, normalizeEmail, extractDomain, } from './utils/email-validator';
|
|
11
|
+
export { replaceVariables, replaceVariablesInHtml, createEmailTemplate, } from './utils/template-engine';
|
|
12
|
+
export { SibilMailError, SmtpConnectionError, EmailValidationError, EmailSendError, } from './errors/sibil-mail-error';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EACL,YAAY,EACZ,WAAW,EACX,UAAU,EACV,eAAe,EACf,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGxF,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,aAAa,GACd,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,GACf,MAAM,2BAA2B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Sibil Mail - SMTP Email Sending Library
|
|
4
|
+
*
|
|
5
|
+
* Main entry point for the email library.
|
|
6
|
+
* Exports all public APIs for sending emails via SMTP.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.EmailSendError = exports.EmailValidationError = exports.SmtpConnectionError = exports.SibilMailError = exports.createEmailTemplate = exports.replaceVariablesInHtml = exports.replaceVariables = exports.extractDomain = exports.normalizeEmail = exports.validateEmails = exports.isValidEmail = exports.closeTransport = exports.verifySmtpConnection = exports.createSmtpTransport = exports.SibilMail = void 0;
|
|
10
|
+
// Main classes
|
|
11
|
+
var sibil_mail_1 = require("./sibil-mail");
|
|
12
|
+
Object.defineProperty(exports, "SibilMail", { enumerable: true, get: function () { return sibil_mail_1.SibilMail; } });
|
|
13
|
+
// Transport utilities
|
|
14
|
+
var transport_1 = require("./transport");
|
|
15
|
+
Object.defineProperty(exports, "createSmtpTransport", { enumerable: true, get: function () { return transport_1.createSmtpTransport; } });
|
|
16
|
+
Object.defineProperty(exports, "verifySmtpConnection", { enumerable: true, get: function () { return transport_1.verifySmtpConnection; } });
|
|
17
|
+
Object.defineProperty(exports, "closeTransport", { enumerable: true, get: function () { return transport_1.closeTransport; } });
|
|
18
|
+
// Validation utilities
|
|
19
|
+
var email_validator_1 = require("./utils/email-validator");
|
|
20
|
+
Object.defineProperty(exports, "isValidEmail", { enumerable: true, get: function () { return email_validator_1.isValidEmail; } });
|
|
21
|
+
Object.defineProperty(exports, "validateEmails", { enumerable: true, get: function () { return email_validator_1.validateEmails; } });
|
|
22
|
+
Object.defineProperty(exports, "normalizeEmail", { enumerable: true, get: function () { return email_validator_1.normalizeEmail; } });
|
|
23
|
+
Object.defineProperty(exports, "extractDomain", { enumerable: true, get: function () { return email_validator_1.extractDomain; } });
|
|
24
|
+
// Template utilities
|
|
25
|
+
var template_engine_1 = require("./utils/template-engine");
|
|
26
|
+
Object.defineProperty(exports, "replaceVariables", { enumerable: true, get: function () { return template_engine_1.replaceVariables; } });
|
|
27
|
+
Object.defineProperty(exports, "replaceVariablesInHtml", { enumerable: true, get: function () { return template_engine_1.replaceVariablesInHtml; } });
|
|
28
|
+
Object.defineProperty(exports, "createEmailTemplate", { enumerable: true, get: function () { return template_engine_1.createEmailTemplate; } });
|
|
29
|
+
// Error classes
|
|
30
|
+
var sibil_mail_error_1 = require("./errors/sibil-mail-error");
|
|
31
|
+
Object.defineProperty(exports, "SibilMailError", { enumerable: true, get: function () { return sibil_mail_error_1.SibilMailError; } });
|
|
32
|
+
Object.defineProperty(exports, "SmtpConnectionError", { enumerable: true, get: function () { return sibil_mail_error_1.SmtpConnectionError; } });
|
|
33
|
+
Object.defineProperty(exports, "EmailValidationError", { enumerable: true, get: function () { return sibil_mail_error_1.EmailValidationError; } });
|
|
34
|
+
Object.defineProperty(exports, "EmailSendError", { enumerable: true, get: function () { return sibil_mail_error_1.EmailSendError; } });
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,eAAe;AACf,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAWlB,sBAAsB;AACtB,yCAAwF;AAA/E,gHAAA,mBAAmB,OAAA;AAAE,iHAAA,oBAAoB,OAAA;AAAE,2GAAA,cAAc,OAAA;AAElE,uBAAuB;AACvB,2DAKiC;AAJ/B,+GAAA,YAAY,OAAA;AACZ,iHAAA,cAAc,OAAA;AACd,iHAAA,cAAc,OAAA;AACd,gHAAA,aAAa,OAAA;AAGf,qBAAqB;AACrB,2DAIiC;AAH/B,mHAAA,gBAAgB,OAAA;AAChB,yHAAA,sBAAsB,OAAA;AACtB,sHAAA,mBAAmB,OAAA;AAGrB,gBAAgB;AAChB,8DAKmC;AAJjC,kHAAA,cAAc,OAAA;AACd,uHAAA,mBAAmB,OAAA;AACnB,wHAAA,oBAAoB,OAAA;AACpB,kHAAA,cAAc,OAAA"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SibilMail Class
|
|
3
|
+
*
|
|
4
|
+
* Professional email sending service with comprehensive error handling,
|
|
5
|
+
* retry mechanisms, and support for various SMTP providers.
|
|
6
|
+
*/
|
|
7
|
+
import { Transporter } from 'nodemailer';
|
|
8
|
+
import { EmailOptions, EmailResult, SmtpConfig } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* Retry Configuration
|
|
11
|
+
*/
|
|
12
|
+
interface RetryConfig {
|
|
13
|
+
maxRetries: number;
|
|
14
|
+
retryDelay: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* SibilMail Class
|
|
18
|
+
*
|
|
19
|
+
* Professional email sending service with:
|
|
20
|
+
* - Automatic retry on failure
|
|
21
|
+
* - Comprehensive error handling
|
|
22
|
+
* - Email validation
|
|
23
|
+
* - Connection pooling
|
|
24
|
+
* - Provider-specific optimizations
|
|
25
|
+
*/
|
|
26
|
+
export declare class SibilMail {
|
|
27
|
+
private transporter;
|
|
28
|
+
private config;
|
|
29
|
+
private retryConfig;
|
|
30
|
+
/**
|
|
31
|
+
* Constructor
|
|
32
|
+
*
|
|
33
|
+
* @param config - SMTP configuration
|
|
34
|
+
* @param retryConfig - Optional retry configuration
|
|
35
|
+
*/
|
|
36
|
+
constructor(config: SmtpConfig, retryConfig?: Partial<RetryConfig>);
|
|
37
|
+
/**
|
|
38
|
+
* Normalize Configuration
|
|
39
|
+
*
|
|
40
|
+
* Cleans and validates configuration before use.
|
|
41
|
+
*/
|
|
42
|
+
private normalizeConfig;
|
|
43
|
+
/**
|
|
44
|
+
* Sleep Helper
|
|
45
|
+
*
|
|
46
|
+
* Waits for specified milliseconds.
|
|
47
|
+
*/
|
|
48
|
+
private sleep;
|
|
49
|
+
/**
|
|
50
|
+
* Retry Operation
|
|
51
|
+
*
|
|
52
|
+
* Retries an operation with exponential backoff.
|
|
53
|
+
*/
|
|
54
|
+
private retry;
|
|
55
|
+
/**
|
|
56
|
+
* Validate Email Options
|
|
57
|
+
*
|
|
58
|
+
* Validates email options before sending.
|
|
59
|
+
*/
|
|
60
|
+
private validateEmailOptions;
|
|
61
|
+
/**
|
|
62
|
+
* Send Email
|
|
63
|
+
*
|
|
64
|
+
* Sends an email with automatic retry on failure.
|
|
65
|
+
*
|
|
66
|
+
* @param options - Email options
|
|
67
|
+
* @returns Promise resolving to email result
|
|
68
|
+
*/
|
|
69
|
+
send(options: EmailOptions): Promise<EmailResult>;
|
|
70
|
+
/**
|
|
71
|
+
* Get Error Message
|
|
72
|
+
*
|
|
73
|
+
* Extracts and formats error message from various error types.
|
|
74
|
+
*/
|
|
75
|
+
private getErrorMessage;
|
|
76
|
+
/**
|
|
77
|
+
* Verify Connection
|
|
78
|
+
*
|
|
79
|
+
* Tests the SMTP connection with retry mechanism.
|
|
80
|
+
*
|
|
81
|
+
* @returns Promise resolving to true if connection is valid
|
|
82
|
+
* @throws SmtpConnectionError if connection fails
|
|
83
|
+
*/
|
|
84
|
+
verifyConnection(): Promise<boolean>;
|
|
85
|
+
/**
|
|
86
|
+
* Get Transporter
|
|
87
|
+
*
|
|
88
|
+
* Returns the underlying nodemailer transporter instance.
|
|
89
|
+
*
|
|
90
|
+
* @returns Nodemailer transporter instance
|
|
91
|
+
*/
|
|
92
|
+
getTransporter(): Transporter;
|
|
93
|
+
/**
|
|
94
|
+
* Update Configuration
|
|
95
|
+
*
|
|
96
|
+
* Updates SMTP configuration and recreates transporter.
|
|
97
|
+
*
|
|
98
|
+
* @param config - New SMTP configuration
|
|
99
|
+
*/
|
|
100
|
+
updateConfig(config: SmtpConfig): void;
|
|
101
|
+
/**
|
|
102
|
+
* Get Configuration
|
|
103
|
+
*
|
|
104
|
+
* Returns current SMTP configuration (password masked).
|
|
105
|
+
*
|
|
106
|
+
* @returns SMTP configuration
|
|
107
|
+
*/
|
|
108
|
+
getConfig(): Omit<SmtpConfig, 'auth'> & {
|
|
109
|
+
auth: {
|
|
110
|
+
user: string;
|
|
111
|
+
pass: string;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Close Connection
|
|
116
|
+
*
|
|
117
|
+
* Properly closes the transporter connection pool.
|
|
118
|
+
* Call this when done using the mailer instance.
|
|
119
|
+
*/
|
|
120
|
+
close(): Promise<void>;
|
|
121
|
+
}
|
|
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AA;KAAE;IAUhF;;;;;OAKG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* SibilMail Class
|
|
4
|
+
*
|
|
5
|
+
* Professional email sending service with comprehensive error handling,
|
|
6
|
+
* retry mechanisms, and support for various SMTP providers.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.SibilMail = void 0;
|
|
10
|
+
const transport_1 = require("./transport");
|
|
11
|
+
const email_validator_1 = require("./utils/email-validator");
|
|
12
|
+
const sibil_mail_error_1 = require("./errors/sibil-mail-error");
|
|
13
|
+
const DEFAULT_RETRY_CONFIG = {
|
|
14
|
+
maxRetries: 3,
|
|
15
|
+
retryDelay: 1000, // 1 second
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* SibilMail Class
|
|
19
|
+
*
|
|
20
|
+
* Professional email sending service with:
|
|
21
|
+
* - Automatic retry on failure
|
|
22
|
+
* - Comprehensive error handling
|
|
23
|
+
* - Email validation
|
|
24
|
+
* - Connection pooling
|
|
25
|
+
* - Provider-specific optimizations
|
|
26
|
+
*/
|
|
27
|
+
class SibilMail {
|
|
28
|
+
/**
|
|
29
|
+
* Constructor
|
|
30
|
+
*
|
|
31
|
+
* @param config - SMTP configuration
|
|
32
|
+
* @param retryConfig - Optional retry configuration
|
|
33
|
+
*/
|
|
34
|
+
constructor(config, retryConfig) {
|
|
35
|
+
this.config = this.normalizeConfig(config);
|
|
36
|
+
this.retryConfig = { ...DEFAULT_RETRY_CONFIG, ...retryConfig };
|
|
37
|
+
this.transporter = (0, transport_1.createSmtpTransport)(this.config);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Normalize Configuration
|
|
41
|
+
*
|
|
42
|
+
* Cleans and validates configuration before use.
|
|
43
|
+
*/
|
|
44
|
+
normalizeConfig(config) {
|
|
45
|
+
return {
|
|
46
|
+
...config,
|
|
47
|
+
host: config.host.trim(),
|
|
48
|
+
port: config.port,
|
|
49
|
+
secure: config.secure,
|
|
50
|
+
auth: {
|
|
51
|
+
user: config.auth.user.trim(),
|
|
52
|
+
pass: config.auth.pass.trim(),
|
|
53
|
+
},
|
|
54
|
+
tls: config.tls,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Sleep Helper
|
|
59
|
+
*
|
|
60
|
+
* Waits for specified milliseconds.
|
|
61
|
+
*/
|
|
62
|
+
sleep(ms) {
|
|
63
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Retry Operation
|
|
67
|
+
*
|
|
68
|
+
* Retries an operation with exponential backoff.
|
|
69
|
+
*/
|
|
70
|
+
async retry(operation, operationName) {
|
|
71
|
+
let lastError = null;
|
|
72
|
+
for (let attempt = 1; attempt <= this.retryConfig.maxRetries; attempt++) {
|
|
73
|
+
try {
|
|
74
|
+
return await operation();
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
78
|
+
if (attempt < this.retryConfig.maxRetries) {
|
|
79
|
+
const delay = this.retryConfig.retryDelay * attempt; // Exponential backoff
|
|
80
|
+
console.warn(`${operationName} failed (attempt ${attempt}/${this.retryConfig.maxRetries}). Retrying in ${delay}ms...`);
|
|
81
|
+
await this.sleep(delay);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
throw lastError || new Error(`${operationName} failed after ${this.retryConfig.maxRetries} attempts`);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Validate Email Options
|
|
89
|
+
*
|
|
90
|
+
* Validates email options before sending.
|
|
91
|
+
*/
|
|
92
|
+
validateEmailOptions(options) {
|
|
93
|
+
// Validate from address
|
|
94
|
+
if (!options.from || !options.from.trim()) {
|
|
95
|
+
return { valid: false, error: 'From address is required' };
|
|
96
|
+
}
|
|
97
|
+
if (!(0, email_validator_1.isValidEmail)(options.from)) {
|
|
98
|
+
return { valid: false, error: `From address is not a valid email: ${options.from}` };
|
|
99
|
+
}
|
|
100
|
+
// Validate to address
|
|
101
|
+
if (!options.to) {
|
|
102
|
+
return { valid: false, error: 'To address is required' };
|
|
103
|
+
}
|
|
104
|
+
const toEmails = Array.isArray(options.to) ? options.to : [options.to];
|
|
105
|
+
if (toEmails.length === 0) {
|
|
106
|
+
return { valid: false, error: 'At least one recipient is required' };
|
|
107
|
+
}
|
|
108
|
+
const { valid, invalid } = (0, email_validator_1.validateEmails)(toEmails);
|
|
109
|
+
if (invalid.length > 0) {
|
|
110
|
+
return { valid: false, error: `Invalid email addresses: ${invalid.join(', ')}` };
|
|
111
|
+
}
|
|
112
|
+
// Validate subject
|
|
113
|
+
if (!options.subject || !options.subject.trim()) {
|
|
114
|
+
return { valid: false, error: 'Subject is required' };
|
|
115
|
+
}
|
|
116
|
+
// Validate body
|
|
117
|
+
if (!options.text && !options.html) {
|
|
118
|
+
return { valid: false, error: 'Either text or html body is required' };
|
|
119
|
+
}
|
|
120
|
+
// Validate CC if provided
|
|
121
|
+
if (options.cc) {
|
|
122
|
+
const ccEmails = Array.isArray(options.cc) ? options.cc : [options.cc];
|
|
123
|
+
const { invalid: invalidCC } = (0, email_validator_1.validateEmails)(ccEmails);
|
|
124
|
+
if (invalidCC.length > 0) {
|
|
125
|
+
return { valid: false, error: `Invalid CC email addresses: ${invalidCC.join(', ')}` };
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
// Validate BCC if provided
|
|
129
|
+
if (options.bcc) {
|
|
130
|
+
const bccEmails = Array.isArray(options.bcc) ? options.bcc : [options.bcc];
|
|
131
|
+
const { invalid: invalidBCC } = (0, email_validator_1.validateEmails)(bccEmails);
|
|
132
|
+
if (invalidBCC.length > 0) {
|
|
133
|
+
return { valid: false, error: `Invalid BCC email addresses: ${invalidBCC.join(', ')}` };
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return { valid: true };
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Send Email
|
|
140
|
+
*
|
|
141
|
+
* Sends an email with automatic retry on failure.
|
|
142
|
+
*
|
|
143
|
+
* @param options - Email options
|
|
144
|
+
* @returns Promise resolving to email result
|
|
145
|
+
*/
|
|
146
|
+
async send(options) {
|
|
147
|
+
// Validate options
|
|
148
|
+
const validation = this.validateEmailOptions(options);
|
|
149
|
+
if (!validation.valid) {
|
|
150
|
+
return {
|
|
151
|
+
success: false,
|
|
152
|
+
error: validation.error || 'Validation failed',
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
// Prepare email data
|
|
156
|
+
const emailData = {
|
|
157
|
+
from: options.from.trim(),
|
|
158
|
+
to: options.to,
|
|
159
|
+
subject: options.subject.trim(),
|
|
160
|
+
text: options.text?.trim(),
|
|
161
|
+
html: options.html?.trim(),
|
|
162
|
+
cc: options.cc,
|
|
163
|
+
bcc: options.bcc,
|
|
164
|
+
replyTo: options.replyTo?.trim(),
|
|
165
|
+
attachments: options.attachments,
|
|
166
|
+
};
|
|
167
|
+
// Send with retry
|
|
168
|
+
try {
|
|
169
|
+
const info = await this.retry(() => this.transporter.sendMail(emailData), 'Send email');
|
|
170
|
+
return {
|
|
171
|
+
success: true,
|
|
172
|
+
messageId: info.messageId,
|
|
173
|
+
response: info.response,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
const errorMessage = this.getErrorMessage(error);
|
|
178
|
+
return {
|
|
179
|
+
success: false,
|
|
180
|
+
error: errorMessage,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Get Error Message
|
|
186
|
+
*
|
|
187
|
+
* Extracts and formats error message from various error types.
|
|
188
|
+
*/
|
|
189
|
+
getErrorMessage(error) {
|
|
190
|
+
if (error instanceof Error) {
|
|
191
|
+
const message = error.message.toLowerCase();
|
|
192
|
+
// Authentication errors
|
|
193
|
+
if (message.includes('invalid login') || message.includes('authentication failed') || message.includes('535')) {
|
|
194
|
+
return 'Authentication failed: Invalid email or password. For Gmail, ensure you are using an App Password.';
|
|
195
|
+
}
|
|
196
|
+
// Connection errors
|
|
197
|
+
if (message.includes('connection') || message.includes('econnrefused') || message.includes('timeout')) {
|
|
198
|
+
return `Connection failed: Unable to connect to SMTP server. Check your network and firewall settings.`;
|
|
199
|
+
}
|
|
200
|
+
// TLS/SSL errors
|
|
201
|
+
if (message.includes('tls') || message.includes('ssl') || message.includes('certificate')) {
|
|
202
|
+
return `TLS/SSL error: ${error.message}. Try enabling "Ignore TLS Certificate Errors" or use port 465 with SSL.`;
|
|
203
|
+
}
|
|
204
|
+
// Socket errors
|
|
205
|
+
if (message.includes('socket') || message.includes('disconnected')) {
|
|
206
|
+
return `Network error: ${error.message}. Check if the SMTP port is accessible.`;
|
|
207
|
+
}
|
|
208
|
+
// Rate limiting
|
|
209
|
+
if (message.includes('rate') || message.includes('limit') || message.includes('too many')) {
|
|
210
|
+
return 'Rate limit exceeded: Too many emails sent. Please wait before trying again.';
|
|
211
|
+
}
|
|
212
|
+
// Return original message
|
|
213
|
+
return error.message;
|
|
214
|
+
}
|
|
215
|
+
return 'Unknown error occurred while sending email';
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Verify Connection
|
|
219
|
+
*
|
|
220
|
+
* Tests the SMTP connection with retry mechanism.
|
|
221
|
+
*
|
|
222
|
+
* @returns Promise resolving to true if connection is valid
|
|
223
|
+
* @throws SmtpConnectionError if connection fails
|
|
224
|
+
*/
|
|
225
|
+
async verifyConnection() {
|
|
226
|
+
try {
|
|
227
|
+
await this.retry(() => (0, transport_1.verifySmtpConnection)(this.transporter), 'Verify SMTP connection');
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
const message = error instanceof Error ? error.message : 'SMTP connection failed';
|
|
232
|
+
throw new sibil_mail_error_1.SmtpConnectionError(message);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Get Transporter
|
|
237
|
+
*
|
|
238
|
+
* Returns the underlying nodemailer transporter instance.
|
|
239
|
+
*
|
|
240
|
+
* @returns Nodemailer transporter instance
|
|
241
|
+
*/
|
|
242
|
+
getTransporter() {
|
|
243
|
+
return this.transporter;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Update Configuration
|
|
247
|
+
*
|
|
248
|
+
* Updates SMTP configuration and recreates transporter.
|
|
249
|
+
*
|
|
250
|
+
* @param config - New SMTP configuration
|
|
251
|
+
*/
|
|
252
|
+
updateConfig(config) {
|
|
253
|
+
// Close old transporter
|
|
254
|
+
(0, transport_1.closeTransport)(this.transporter).catch(console.error);
|
|
255
|
+
// Update config and create new transporter
|
|
256
|
+
this.config = this.normalizeConfig(config);
|
|
257
|
+
this.transporter = (0, transport_1.createSmtpTransport)(this.config);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Get Configuration
|
|
261
|
+
*
|
|
262
|
+
* Returns current SMTP configuration (password masked).
|
|
263
|
+
*
|
|
264
|
+
* @returns SMTP configuration
|
|
265
|
+
*/
|
|
266
|
+
getConfig() {
|
|
267
|
+
return {
|
|
268
|
+
...this.config,
|
|
269
|
+
auth: {
|
|
270
|
+
user: this.config.auth.user,
|
|
271
|
+
pass: '***',
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Close Connection
|
|
277
|
+
*
|
|
278
|
+
* Properly closes the transporter connection pool.
|
|
279
|
+
* Call this when done using the mailer instance.
|
|
280
|
+
*/
|
|
281
|
+
async close() {
|
|
282
|
+
await (0, transport_1.closeTransport)(this.transporter);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
exports.SibilMail = SibilMail;
|
|
286
|
+
//# sourceMappingURL=sibil-mail.js.map
|
|
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