mikromail 0.0.3 → 0.0.5
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 +4 -36
- package/lib/MikroMail.mjs +2 -2
- package/lib/SMTPClient.js +4 -36
- package/lib/SMTPClient.mjs +1 -1
- package/lib/{chunk-6FVSAIJD.mjs → chunk-JNBOBHOL.mjs} +1 -1
- package/lib/{chunk-LKO73BCK.mjs → chunk-NGYJ2CZH.mjs} +4 -8
- package/lib/index.js +4 -36
- 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("@");
|
|
@@ -618,24 +589,21 @@ var SMTPClient = class {
|
|
|
618
589
|
Content-Type: text/plain; charset=utf-8\r
|
|
619
590
|
Content-Transfer-Encoding: quoted-printable\r
|
|
620
591
|
\r
|
|
621
|
-
${
|
|
592
|
+
${text || ""}\r
|
|
622
593
|
\r
|
|
623
594
|
--${boundary}\r
|
|
624
595
|
Content-Type: text/html; charset=utf-8\r
|
|
625
596
|
Content-Transfer-Encoding: quoted-printable\r
|
|
626
597
|
\r
|
|
627
|
-
${
|
|
598
|
+
${html || ""}\r
|
|
628
599
|
\r
|
|
629
600
|
--${boundary}--\r
|
|
630
601
|
`;
|
|
631
602
|
}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
return `${headers.join("\r\n")}\r
|
|
603
|
+
headers.push("Content-Type: text/html; charset=utf-8");
|
|
604
|
+
if (html) return `${headers.join("\r\n")}\r
|
|
635
605
|
\r
|
|
636
606
|
${html}`;
|
|
637
|
-
}
|
|
638
|
-
headers.push("Content-Type: text/plain; charset=utf-8");
|
|
639
607
|
return `${headers.join("\r\n")}\r
|
|
640
608
|
\r
|
|
641
609
|
${text || ""}`;
|
package/lib/MikroMail.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MikroMail
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JNBOBHOL.mjs";
|
|
4
4
|
import "./chunk-YVXB6HCK.mjs";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-NGYJ2CZH.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("@");
|
|
@@ -474,24 +445,21 @@ var SMTPClient = class {
|
|
|
474
445
|
Content-Type: text/plain; charset=utf-8\r
|
|
475
446
|
Content-Transfer-Encoding: quoted-printable\r
|
|
476
447
|
\r
|
|
477
|
-
${
|
|
448
|
+
${text || ""}\r
|
|
478
449
|
\r
|
|
479
450
|
--${boundary}\r
|
|
480
451
|
Content-Type: text/html; charset=utf-8\r
|
|
481
452
|
Content-Transfer-Encoding: quoted-printable\r
|
|
482
453
|
\r
|
|
483
|
-
${
|
|
454
|
+
${html || ""}\r
|
|
484
455
|
\r
|
|
485
456
|
--${boundary}--\r
|
|
486
457
|
`;
|
|
487
458
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
return `${headers.join("\r\n")}\r
|
|
459
|
+
headers.push("Content-Type: text/html; charset=utf-8");
|
|
460
|
+
if (html) return `${headers.join("\r\n")}\r
|
|
491
461
|
\r
|
|
492
462
|
${html}`;
|
|
493
|
-
}
|
|
494
|
-
headers.push("Content-Type: text/plain; charset=utf-8");
|
|
495
463
|
return `${headers.join("\r\n")}\r
|
|
496
464
|
\r
|
|
497
465
|
${text || ""}`;
|
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
|
|
|
@@ -383,24 +382,21 @@ var SMTPClient = class {
|
|
|
383
382
|
Content-Type: text/plain; charset=utf-8\r
|
|
384
383
|
Content-Transfer-Encoding: quoted-printable\r
|
|
385
384
|
\r
|
|
386
|
-
${
|
|
385
|
+
${text || ""}\r
|
|
387
386
|
\r
|
|
388
387
|
--${boundary}\r
|
|
389
388
|
Content-Type: text/html; charset=utf-8\r
|
|
390
389
|
Content-Transfer-Encoding: quoted-printable\r
|
|
391
390
|
\r
|
|
392
|
-
${
|
|
391
|
+
${html || ""}\r
|
|
393
392
|
\r
|
|
394
393
|
--${boundary}--\r
|
|
395
394
|
`;
|
|
396
395
|
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
return `${headers.join("\r\n")}\r
|
|
396
|
+
headers.push("Content-Type: text/html; charset=utf-8");
|
|
397
|
+
if (html) return `${headers.join("\r\n")}\r
|
|
400
398
|
\r
|
|
401
399
|
${html}`;
|
|
402
|
-
}
|
|
403
|
-
headers.push("Content-Type: text/plain; charset=utf-8");
|
|
404
400
|
return `${headers.join("\r\n")}\r
|
|
405
401
|
\r
|
|
406
402
|
${text || ""}`;
|
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("@");
|
|
@@ -618,24 +589,21 @@ var SMTPClient = class {
|
|
|
618
589
|
Content-Type: text/plain; charset=utf-8\r
|
|
619
590
|
Content-Transfer-Encoding: quoted-printable\r
|
|
620
591
|
\r
|
|
621
|
-
${
|
|
592
|
+
${text || ""}\r
|
|
622
593
|
\r
|
|
623
594
|
--${boundary}\r
|
|
624
595
|
Content-Type: text/html; charset=utf-8\r
|
|
625
596
|
Content-Transfer-Encoding: quoted-printable\r
|
|
626
597
|
\r
|
|
627
|
-
${
|
|
598
|
+
${html || ""}\r
|
|
628
599
|
\r
|
|
629
600
|
--${boundary}--\r
|
|
630
601
|
`;
|
|
631
602
|
}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
return `${headers.join("\r\n")}\r
|
|
603
|
+
headers.push("Content-Type: text/html; charset=utf-8");
|
|
604
|
+
if (html) return `${headers.join("\r\n")}\r
|
|
635
605
|
\r
|
|
636
606
|
${html}`;
|
|
637
|
-
}
|
|
638
|
-
headers.push("Content-Type: text/plain; charset=utf-8");
|
|
639
607
|
return `${headers.join("\r\n")}\r
|
|
640
608
|
\r
|
|
641
609
|
${text || ""}`;
|
package/lib/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MikroMail
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JNBOBHOL.mjs";
|
|
4
4
|
import "./chunk-YVXB6HCK.mjs";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-NGYJ2CZH.mjs";
|
|
6
6
|
import "./chunk-47VXJTWV.mjs";
|
|
7
7
|
import "./chunk-UDLJWUFN.mjs";
|
|
8
8
|
export {
|
package/package.json
CHANGED