arn-rawmime 0.1.0 → 0.1.2

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.0",
3
+ "version": "0.1.2",
4
4
  "description": "A lightweight, dependency-free raw MIME email builder with DKIM support.",
5
5
  "author": "ARNDESK",
6
6
  "type": "module",
@@ -491,7 +491,7 @@ class MimeMessage {
491
491
  data,
492
492
  encoding = "quoted-printable",
493
493
  autoTextPart = false,
494
- autoMinify = true,
494
+ autoMinify = null,
495
495
  markdownToHtml = false,
496
496
  charset = "UTF-8",
497
497
  }) {
@@ -532,7 +532,8 @@ class MimeMessage {
532
532
 
533
533
  let finalHtml = data;
534
534
 
535
- if (autoMinify) {
535
+ const shouldMinify = autoMinify !== null && autoMinify !== undefined ? autoMinify : (this.boundaryStyle !== "outlook");
536
+ if (shouldMinify) {
536
537
  finalHtml = this._minifyHtml(finalHtml);
537
538
  }
538
539
 
@@ -628,11 +629,14 @@ class MimeMessage {
628
629
  // Wait for Attachments AND Markdown Processing
629
630
  await Promise.all([...this.attachmentPromises, ...this.processingPromises]);
630
631
 
631
- if (!this.headers.some((h) => h.name.toLowerCase() === "mime-version"))
632
+ if (!this.headers.some((h) => h.name.toLowerCase() === "mime-version") && !this.removedHeaders.has("mime-version"))
632
633
  this.headers.unshift({ name: "MIME-Version", value: "1.0" });
633
- if (!this.headers.some((h) => h.name.toLowerCase() === "date")) this.setDate();
634
- if (!this.headers.some((h) => h.name.toLowerCase() === "message-id")) this.messageId();
635
- if (!this.headers.some((h) => h.name.toLowerCase() === "subject")) this.setSubject("");
634
+ if (!this.headers.some((h) => h.name.toLowerCase() === "date") && !this.removedHeaders.has("date"))
635
+ this.setDate();
636
+ if (!this.headers.some((h) => h.name.toLowerCase() === "message-id") && !this.removedHeaders.has("message-id"))
637
+ this.messageId();
638
+ if (!this.headers.some((h) => h.name.toLowerCase() === "subject") && !this.removedHeaders.has("subject"))
639
+ this.setSubject("");
636
640
 
637
641
  // Sort Body: Text parts must come before HTML parts, keeping stable addition order
638
642
  const texts = this.bodyParts.filter((p) => p.contentType === "text/plain");