mikromail 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+ import {
2
+ MikroMail
3
+ } from "./chunk-XNGASLEZ.mjs";
4
+ import "./chunk-V2NYOKWA.mjs";
5
+ import "./chunk-TCYL3UFZ.mjs";
6
+ import "./chunk-47VXJTWV.mjs";
7
+ import "./chunk-UDLJWUFN.mjs";
8
+ export {
9
+ MikroMail
10
+ };
@@ -0,0 +1,106 @@
1
+ import { SMTPConfiguration, EmailOptions, SendResult } from './interfaces/index.mjs';
2
+
3
+ /**
4
+ * Enhanced SMTP client for sending emails without dependencies
5
+ * Supports HTML content, improved security and comprehensive error handling
6
+ */
7
+ declare class SMTPClient {
8
+ private config;
9
+ private socket;
10
+ private connected;
11
+ private lastCommand;
12
+ private serverCapabilities;
13
+ private secureMode;
14
+ private retryCount;
15
+ constructor(config: SMTPConfiguration);
16
+ /**
17
+ * Log debug messages if debug mode is enabled
18
+ */
19
+ private log;
20
+ /**
21
+ * Connect to the SMTP server
22
+ */
23
+ connect(): Promise<void>;
24
+ /**
25
+ * Create a secure TLS connection
26
+ */
27
+ private createTLSConnection;
28
+ /**
29
+ * Create a plain socket connection (for later STARTTLS upgrade)
30
+ */
31
+ private createPlainConnection;
32
+ /**
33
+ * Set up common socket event handlers
34
+ */
35
+ private setupSocketEventHandlers;
36
+ /**
37
+ * Upgrade connection to TLS using STARTTLS
38
+ */
39
+ private upgradeToTLS;
40
+ /**
41
+ * Send an SMTP command and await response
42
+ */
43
+ sendCommand(command: string, expectedCode: number, timeout?: number): Promise<string>;
44
+ /**
45
+ * Parse EHLO response to determine server capabilities
46
+ */
47
+ private parseCapabilities;
48
+ /**
49
+ * Determine the best authentication method supported by the server
50
+ */
51
+ private getBestAuthMethod;
52
+ /**
53
+ * Authenticate with the SMTP server using the best available method
54
+ */
55
+ private authenticate;
56
+ /**
57
+ * Authenticate using PLAIN method
58
+ */
59
+ private authenticatePlain;
60
+ /**
61
+ * Authenticate using LOGIN method
62
+ */
63
+ private authenticateLogin;
64
+ /**
65
+ * Authenticate using CRAM-MD5 method
66
+ */
67
+ private authenticateCramMD5;
68
+ /**
69
+ * Generate a unique message ID
70
+ */
71
+ private generateMessageId;
72
+ /**
73
+ * Generate MIME boundary for multipart messages
74
+ */
75
+ private generateBoundary;
76
+ /**
77
+ * Encode string according to RFC 2047 for headers with non-ASCII characters
78
+ */
79
+ private encodeHeaderValue;
80
+ /**
81
+ * Sanitize and encode header value to prevent injection and handle internationalization
82
+ */
83
+ private sanitizeHeader;
84
+ /**
85
+ * Create email headers with proper sanitization
86
+ */
87
+ private createEmailHeaders;
88
+ /**
89
+ * Create a multipart email with text and HTML parts
90
+ */
91
+ private createMultipartEmail;
92
+ /**
93
+ * Perform full SMTP handshake, including STARTTLS if needed
94
+ */
95
+ private smtpHandshake;
96
+ /**
97
+ * Send an email with retry capability
98
+ */
99
+ sendEmail(options: EmailOptions): Promise<SendResult>;
100
+ /**
101
+ * Close the connection gracefully
102
+ */
103
+ close(): Promise<void>;
104
+ }
105
+
106
+ export { SMTPClient };
@@ -0,0 +1,106 @@
1
+ import { SMTPConfiguration, EmailOptions, SendResult } from './interfaces/index.js';
2
+
3
+ /**
4
+ * Enhanced SMTP client for sending emails without dependencies
5
+ * Supports HTML content, improved security and comprehensive error handling
6
+ */
7
+ declare class SMTPClient {
8
+ private config;
9
+ private socket;
10
+ private connected;
11
+ private lastCommand;
12
+ private serverCapabilities;
13
+ private secureMode;
14
+ private retryCount;
15
+ constructor(config: SMTPConfiguration);
16
+ /**
17
+ * Log debug messages if debug mode is enabled
18
+ */
19
+ private log;
20
+ /**
21
+ * Connect to the SMTP server
22
+ */
23
+ connect(): Promise<void>;
24
+ /**
25
+ * Create a secure TLS connection
26
+ */
27
+ private createTLSConnection;
28
+ /**
29
+ * Create a plain socket connection (for later STARTTLS upgrade)
30
+ */
31
+ private createPlainConnection;
32
+ /**
33
+ * Set up common socket event handlers
34
+ */
35
+ private setupSocketEventHandlers;
36
+ /**
37
+ * Upgrade connection to TLS using STARTTLS
38
+ */
39
+ private upgradeToTLS;
40
+ /**
41
+ * Send an SMTP command and await response
42
+ */
43
+ sendCommand(command: string, expectedCode: number, timeout?: number): Promise<string>;
44
+ /**
45
+ * Parse EHLO response to determine server capabilities
46
+ */
47
+ private parseCapabilities;
48
+ /**
49
+ * Determine the best authentication method supported by the server
50
+ */
51
+ private getBestAuthMethod;
52
+ /**
53
+ * Authenticate with the SMTP server using the best available method
54
+ */
55
+ private authenticate;
56
+ /**
57
+ * Authenticate using PLAIN method
58
+ */
59
+ private authenticatePlain;
60
+ /**
61
+ * Authenticate using LOGIN method
62
+ */
63
+ private authenticateLogin;
64
+ /**
65
+ * Authenticate using CRAM-MD5 method
66
+ */
67
+ private authenticateCramMD5;
68
+ /**
69
+ * Generate a unique message ID
70
+ */
71
+ private generateMessageId;
72
+ /**
73
+ * Generate MIME boundary for multipart messages
74
+ */
75
+ private generateBoundary;
76
+ /**
77
+ * Encode string according to RFC 2047 for headers with non-ASCII characters
78
+ */
79
+ private encodeHeaderValue;
80
+ /**
81
+ * Sanitize and encode header value to prevent injection and handle internationalization
82
+ */
83
+ private sanitizeHeader;
84
+ /**
85
+ * Create email headers with proper sanitization
86
+ */
87
+ private createEmailHeaders;
88
+ /**
89
+ * Create a multipart email with text and HTML parts
90
+ */
91
+ private createMultipartEmail;
92
+ /**
93
+ * Perform full SMTP handshake, including STARTTLS if needed
94
+ */
95
+ private smtpHandshake;
96
+ /**
97
+ * Send an email with retry capability
98
+ */
99
+ sendEmail(options: EmailOptions): Promise<SendResult>;
100
+ /**
101
+ * Close the connection gracefully
102
+ */
103
+ close(): Promise<void>;
104
+ }
105
+
106
+ export { SMTPClient };