arn-rawmime 0.1.4 → 0.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arn-rawmime",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "A lightweight, dependency-free raw MIME email builder with DKIM support.",
5
5
  "author": "ARNDESK",
6
6
  "type": "module",
@@ -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.
@@ -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.bodyParts = [...texts, ...htmls];
656
+ if (!this.preserveOrder) {
657
+ this.bodyParts = [...texts, ...htmls];
658
+ }
652
659
 
653
660
  let body = "";
654
661
  const numAttachments = this.attachments.length;