mikromail 0.0.4 → 0.0.6
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/lib/MikroMail.js +3 -35
- package/lib/MikroMail.mjs +2 -2
- package/lib/SMTPClient.js +3 -35
- package/lib/SMTPClient.mjs +1 -1
- package/lib/{chunk-TBZ7DVGE.mjs → chunk-FP3YCQBU.mjs} +1 -1
- package/lib/{chunk-5JI6BRUL.mjs → chunk-HZ3BDGTE.mjs} +3 -7
- package/lib/index.js +3 -35
- package/lib/index.mjs +2 -2
- package/package.json +1 -1
package/lib/MikroMail.js
CHANGED
|
@@ -168,35 +168,6 @@ var import_node_tls = __toESM(require("tls"));
|
|
|
168
168
|
|
|
169
169
|
// src/utils/index.ts
|
|
170
170
|
var import_node_dns = require("dns");
|
|
171
|
-
function encodeQuotedPrintable(text) {
|
|
172
|
-
let result = text.replace(/\r?\n/g, "\r\n");
|
|
173
|
-
result = result.replace(/=/g, "=3D");
|
|
174
|
-
const utf8Bytes = new TextEncoder().encode(result);
|
|
175
|
-
let encoded = "";
|
|
176
|
-
let lineLength = 0;
|
|
177
|
-
for (let i = 0; i < utf8Bytes.length; i++) {
|
|
178
|
-
const byte = utf8Bytes[i];
|
|
179
|
-
let chunk = "";
|
|
180
|
-
if (byte >= 33 && byte <= 126 && byte !== 61 || byte === 32) {
|
|
181
|
-
chunk = String.fromCharCode(byte);
|
|
182
|
-
} else if (byte === 13 || byte === 10) {
|
|
183
|
-
chunk = String.fromCharCode(byte);
|
|
184
|
-
if (byte === 10) {
|
|
185
|
-
lineLength = 0;
|
|
186
|
-
}
|
|
187
|
-
} else {
|
|
188
|
-
const hex = byte.toString(16).toUpperCase();
|
|
189
|
-
chunk = `=${hex.length < 2 ? `0${hex}` : hex}`;
|
|
190
|
-
}
|
|
191
|
-
if (lineLength + chunk.length > 75 && !(byte === 13 || byte === 10)) {
|
|
192
|
-
encoded += "=\r\n";
|
|
193
|
-
lineLength = 0;
|
|
194
|
-
}
|
|
195
|
-
encoded += chunk;
|
|
196
|
-
lineLength += chunk.length;
|
|
197
|
-
}
|
|
198
|
-
return encoded;
|
|
199
|
-
}
|
|
200
171
|
function validateEmail(email) {
|
|
201
172
|
try {
|
|
202
173
|
const [localPart, domain] = email.split("@");
|
|
@@ -582,8 +553,7 @@ var SMTPClient = class {
|
|
|
582
553
|
`Subject: ${this.sanitizeHeader(options.subject)}`,
|
|
583
554
|
`Message-ID: ${messageId}`,
|
|
584
555
|
`Date: ${date}`,
|
|
585
|
-
"MIME-Version: 1.0"
|
|
586
|
-
"Content-Transfer-Encoding: quoted-printable"
|
|
556
|
+
"MIME-Version: 1.0"
|
|
587
557
|
];
|
|
588
558
|
if (options.cc) {
|
|
589
559
|
const cc = Array.isArray(options.cc) ? options.cc.join(", ") : options.cc;
|
|
@@ -616,15 +586,13 @@ var SMTPClient = class {
|
|
|
616
586
|
\r
|
|
617
587
|
--${boundary}\r
|
|
618
588
|
Content-Type: text/plain; charset=utf-8\r
|
|
619
|
-
Content-Transfer-Encoding: quoted-printable\r
|
|
620
589
|
\r
|
|
621
|
-
${
|
|
590
|
+
${text || ""}\r
|
|
622
591
|
\r
|
|
623
592
|
--${boundary}\r
|
|
624
593
|
Content-Type: text/html; charset=utf-8\r
|
|
625
|
-
Content-Transfer-Encoding: quoted-printable\r
|
|
626
594
|
\r
|
|
627
|
-
${
|
|
595
|
+
${html || ""}\r
|
|
628
596
|
\r
|
|
629
597
|
--${boundary}--\r
|
|
630
598
|
`;
|
package/lib/MikroMail.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MikroMail
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FP3YCQBU.mjs";
|
|
4
4
|
import "./chunk-YVXB6HCK.mjs";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-HZ3BDGTE.mjs";
|
|
6
6
|
import "./chunk-47VXJTWV.mjs";
|
|
7
7
|
import "./chunk-UDLJWUFN.mjs";
|
|
8
8
|
export {
|
package/lib/SMTPClient.js
CHANGED
|
@@ -41,35 +41,6 @@ var import_node_tls = __toESM(require("tls"));
|
|
|
41
41
|
|
|
42
42
|
// src/utils/index.ts
|
|
43
43
|
var import_node_dns = require("dns");
|
|
44
|
-
function encodeQuotedPrintable(text) {
|
|
45
|
-
let result = text.replace(/\r?\n/g, "\r\n");
|
|
46
|
-
result = result.replace(/=/g, "=3D");
|
|
47
|
-
const utf8Bytes = new TextEncoder().encode(result);
|
|
48
|
-
let encoded = "";
|
|
49
|
-
let lineLength = 0;
|
|
50
|
-
for (let i = 0; i < utf8Bytes.length; i++) {
|
|
51
|
-
const byte = utf8Bytes[i];
|
|
52
|
-
let chunk = "";
|
|
53
|
-
if (byte >= 33 && byte <= 126 && byte !== 61 || byte === 32) {
|
|
54
|
-
chunk = String.fromCharCode(byte);
|
|
55
|
-
} else if (byte === 13 || byte === 10) {
|
|
56
|
-
chunk = String.fromCharCode(byte);
|
|
57
|
-
if (byte === 10) {
|
|
58
|
-
lineLength = 0;
|
|
59
|
-
}
|
|
60
|
-
} else {
|
|
61
|
-
const hex = byte.toString(16).toUpperCase();
|
|
62
|
-
chunk = `=${hex.length < 2 ? `0${hex}` : hex}`;
|
|
63
|
-
}
|
|
64
|
-
if (lineLength + chunk.length > 75 && !(byte === 13 || byte === 10)) {
|
|
65
|
-
encoded += "=\r\n";
|
|
66
|
-
lineLength = 0;
|
|
67
|
-
}
|
|
68
|
-
encoded += chunk;
|
|
69
|
-
lineLength += chunk.length;
|
|
70
|
-
}
|
|
71
|
-
return encoded;
|
|
72
|
-
}
|
|
73
44
|
function validateEmail(email) {
|
|
74
45
|
try {
|
|
75
46
|
const [localPart, domain] = email.split("@");
|
|
@@ -438,8 +409,7 @@ var SMTPClient = class {
|
|
|
438
409
|
`Subject: ${this.sanitizeHeader(options.subject)}`,
|
|
439
410
|
`Message-ID: ${messageId}`,
|
|
440
411
|
`Date: ${date}`,
|
|
441
|
-
"MIME-Version: 1.0"
|
|
442
|
-
"Content-Transfer-Encoding: quoted-printable"
|
|
412
|
+
"MIME-Version: 1.0"
|
|
443
413
|
];
|
|
444
414
|
if (options.cc) {
|
|
445
415
|
const cc = Array.isArray(options.cc) ? options.cc.join(", ") : options.cc;
|
|
@@ -472,15 +442,13 @@ var SMTPClient = class {
|
|
|
472
442
|
\r
|
|
473
443
|
--${boundary}\r
|
|
474
444
|
Content-Type: text/plain; charset=utf-8\r
|
|
475
|
-
Content-Transfer-Encoding: quoted-printable\r
|
|
476
445
|
\r
|
|
477
|
-
${
|
|
446
|
+
${text || ""}\r
|
|
478
447
|
\r
|
|
479
448
|
--${boundary}\r
|
|
480
449
|
Content-Type: text/html; charset=utf-8\r
|
|
481
|
-
Content-Transfer-Encoding: quoted-printable\r
|
|
482
450
|
\r
|
|
483
|
-
${
|
|
451
|
+
${html || ""}\r
|
|
484
452
|
\r
|
|
485
453
|
--${boundary}--\r
|
|
486
454
|
`;
|
package/lib/SMTPClient.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
encodeQuotedPrintable,
|
|
3
2
|
validateEmail
|
|
4
3
|
} from "./chunk-UDLJWUFN.mjs";
|
|
5
4
|
|
|
@@ -347,8 +346,7 @@ var SMTPClient = class {
|
|
|
347
346
|
`Subject: ${this.sanitizeHeader(options.subject)}`,
|
|
348
347
|
`Message-ID: ${messageId}`,
|
|
349
348
|
`Date: ${date}`,
|
|
350
|
-
"MIME-Version: 1.0"
|
|
351
|
-
"Content-Transfer-Encoding: quoted-printable"
|
|
349
|
+
"MIME-Version: 1.0"
|
|
352
350
|
];
|
|
353
351
|
if (options.cc) {
|
|
354
352
|
const cc = Array.isArray(options.cc) ? options.cc.join(", ") : options.cc;
|
|
@@ -381,15 +379,13 @@ var SMTPClient = class {
|
|
|
381
379
|
\r
|
|
382
380
|
--${boundary}\r
|
|
383
381
|
Content-Type: text/plain; charset=utf-8\r
|
|
384
|
-
Content-Transfer-Encoding: quoted-printable\r
|
|
385
382
|
\r
|
|
386
|
-
${
|
|
383
|
+
${text || ""}\r
|
|
387
384
|
\r
|
|
388
385
|
--${boundary}\r
|
|
389
386
|
Content-Type: text/html; charset=utf-8\r
|
|
390
|
-
Content-Transfer-Encoding: quoted-printable\r
|
|
391
387
|
\r
|
|
392
|
-
${
|
|
388
|
+
${html || ""}\r
|
|
393
389
|
\r
|
|
394
390
|
--${boundary}--\r
|
|
395
391
|
`;
|
package/lib/index.js
CHANGED
|
@@ -168,35 +168,6 @@ var import_node_tls = __toESM(require("tls"));
|
|
|
168
168
|
|
|
169
169
|
// src/utils/index.ts
|
|
170
170
|
var import_node_dns = require("dns");
|
|
171
|
-
function encodeQuotedPrintable(text) {
|
|
172
|
-
let result = text.replace(/\r?\n/g, "\r\n");
|
|
173
|
-
result = result.replace(/=/g, "=3D");
|
|
174
|
-
const utf8Bytes = new TextEncoder().encode(result);
|
|
175
|
-
let encoded = "";
|
|
176
|
-
let lineLength = 0;
|
|
177
|
-
for (let i = 0; i < utf8Bytes.length; i++) {
|
|
178
|
-
const byte = utf8Bytes[i];
|
|
179
|
-
let chunk = "";
|
|
180
|
-
if (byte >= 33 && byte <= 126 && byte !== 61 || byte === 32) {
|
|
181
|
-
chunk = String.fromCharCode(byte);
|
|
182
|
-
} else if (byte === 13 || byte === 10) {
|
|
183
|
-
chunk = String.fromCharCode(byte);
|
|
184
|
-
if (byte === 10) {
|
|
185
|
-
lineLength = 0;
|
|
186
|
-
}
|
|
187
|
-
} else {
|
|
188
|
-
const hex = byte.toString(16).toUpperCase();
|
|
189
|
-
chunk = `=${hex.length < 2 ? `0${hex}` : hex}`;
|
|
190
|
-
}
|
|
191
|
-
if (lineLength + chunk.length > 75 && !(byte === 13 || byte === 10)) {
|
|
192
|
-
encoded += "=\r\n";
|
|
193
|
-
lineLength = 0;
|
|
194
|
-
}
|
|
195
|
-
encoded += chunk;
|
|
196
|
-
lineLength += chunk.length;
|
|
197
|
-
}
|
|
198
|
-
return encoded;
|
|
199
|
-
}
|
|
200
171
|
function validateEmail(email) {
|
|
201
172
|
try {
|
|
202
173
|
const [localPart, domain] = email.split("@");
|
|
@@ -582,8 +553,7 @@ var SMTPClient = class {
|
|
|
582
553
|
`Subject: ${this.sanitizeHeader(options.subject)}`,
|
|
583
554
|
`Message-ID: ${messageId}`,
|
|
584
555
|
`Date: ${date}`,
|
|
585
|
-
"MIME-Version: 1.0"
|
|
586
|
-
"Content-Transfer-Encoding: quoted-printable"
|
|
556
|
+
"MIME-Version: 1.0"
|
|
587
557
|
];
|
|
588
558
|
if (options.cc) {
|
|
589
559
|
const cc = Array.isArray(options.cc) ? options.cc.join(", ") : options.cc;
|
|
@@ -616,15 +586,13 @@ var SMTPClient = class {
|
|
|
616
586
|
\r
|
|
617
587
|
--${boundary}\r
|
|
618
588
|
Content-Type: text/plain; charset=utf-8\r
|
|
619
|
-
Content-Transfer-Encoding: quoted-printable\r
|
|
620
589
|
\r
|
|
621
|
-
${
|
|
590
|
+
${text || ""}\r
|
|
622
591
|
\r
|
|
623
592
|
--${boundary}\r
|
|
624
593
|
Content-Type: text/html; charset=utf-8\r
|
|
625
|
-
Content-Transfer-Encoding: quoted-printable\r
|
|
626
594
|
\r
|
|
627
|
-
${
|
|
595
|
+
${html || ""}\r
|
|
628
596
|
\r
|
|
629
597
|
--${boundary}--\r
|
|
630
598
|
`;
|
package/lib/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MikroMail
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FP3YCQBU.mjs";
|
|
4
4
|
import "./chunk-YVXB6HCK.mjs";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-HZ3BDGTE.mjs";
|
|
6
6
|
import "./chunk-47VXJTWV.mjs";
|
|
7
7
|
import "./chunk-UDLJWUFN.mjs";
|
|
8
8
|
export {
|
package/package.json
CHANGED