arn-rawmime 0.1.4 → 0.1.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/package.json +3 -2
- package/src/rawmimeBuilder.d.ts +7 -2
- package/src/rawmimeBuilder.js +8 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arn-rawmime",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "A lightweight, dependency-free raw MIME email builder with DKIM support.",
|
|
5
5
|
"author": "ARNDESK",
|
|
6
6
|
"type": "module",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"test": "test"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
+
"arn-rawmime": "^0.1.4",
|
|
19
20
|
"he": "^1.2.0",
|
|
20
21
|
"html-to-text": "^10.0.0",
|
|
21
22
|
"mailparser": "^3.9.0",
|
|
@@ -31,4 +32,4 @@
|
|
|
31
32
|
"email"
|
|
32
33
|
],
|
|
33
34
|
"license": "ISC"
|
|
34
|
-
}
|
|
35
|
+
}
|
package/src/rawmimeBuilder.d.ts
CHANGED
|
@@ -40,6 +40,11 @@ export class MimeMessage {
|
|
|
40
40
|
*/
|
|
41
41
|
setBoundaryStyle(style: "google" | "outlook" | "apple-mail"): void;
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Sets whether to preserve the exact insertion order of MIME parts.
|
|
45
|
+
*/
|
|
46
|
+
setPreserveOrder(flag?: boolean): void;
|
|
47
|
+
|
|
43
48
|
/**
|
|
44
49
|
* Sets the Date header using a specific Time Zone or a random US Time Zone.
|
|
45
50
|
* @param options Configuration object.
|
|
@@ -59,7 +64,7 @@ export class MimeMessage {
|
|
|
59
64
|
addText(options: {
|
|
60
65
|
data: string | Buffer;
|
|
61
66
|
encoding?: "quoted-printable" | "base64" | "7bit" | "8bit";
|
|
62
|
-
charset?: "UTF-8" | "ISO-8859-1" | "US-ASCII" | (string & {});
|
|
67
|
+
charset?: "UTF-8" | "utf-8" | "ISO-8859-1" | "iso-8859-1" | "US-ASCII" | "us-ascii" | (string & {});
|
|
63
68
|
}): void;
|
|
64
69
|
|
|
65
70
|
/**
|
|
@@ -74,7 +79,7 @@ export class MimeMessage {
|
|
|
74
79
|
* It will be converted to HTML, sanitized, and used to generate the body.
|
|
75
80
|
*/
|
|
76
81
|
markdownToHtml?: boolean;
|
|
77
|
-
charset?: "UTF-8" | "ISO-8859-1" | "US-ASCII" | (string & {});
|
|
82
|
+
charset?: "UTF-8" | "utf-8" | "ISO-8859-1" | "iso-8859-1" | "US-ASCII" | "us-ascii" | (string & {});
|
|
78
83
|
}): void;
|
|
79
84
|
|
|
80
85
|
/**
|
package/src/rawmimeBuilder.js
CHANGED
|
@@ -30,6 +30,11 @@ class MimeMessage {
|
|
|
30
30
|
this.processingPromises = [];
|
|
31
31
|
this.removedHeaders = new Set();
|
|
32
32
|
this.boundaryStyle = "google";
|
|
33
|
+
this.preserveOrder = false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
setPreserveOrder(flag = true) {
|
|
37
|
+
this.preserveOrder = !!flag;
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
setBoundaryStyle(style) {
|
|
@@ -648,7 +653,9 @@ class MimeMessage {
|
|
|
648
653
|
console.warn(`[MimeMessage] Warning: Multiple text/html parts added (${htmls.length}). Most email clients will only display the last text/html part.`);
|
|
649
654
|
}
|
|
650
655
|
|
|
651
|
-
this.
|
|
656
|
+
if (!this.preserveOrder) {
|
|
657
|
+
this.bodyParts = [...texts, ...htmls];
|
|
658
|
+
}
|
|
652
659
|
|
|
653
660
|
let body = "";
|
|
654
661
|
const numAttachments = this.attachments.length;
|