arn-rawmime 0.1.2 → 0.1.3

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.2",
3
+ "version": "0.1.3",
4
4
  "description": "A lightweight, dependency-free raw MIME email builder with DKIM support.",
5
5
  "author": "ARNDESK",
6
6
  "type": "module",
@@ -60,6 +60,7 @@ export class MimeMessage {
60
60
  data: string | Buffer;
61
61
  encoding?: "quoted-printable" | "base64" | "7bit" | "8bit";
62
62
  charset?: "UTF-8" | "ISO-8859-1" | "US-ASCII" | (string & {});
63
+ autoMinify?: boolean;
63
64
  }): void;
64
65
 
65
66
  /**
@@ -475,8 +475,12 @@ class MimeMessage {
475
475
  }
476
476
 
477
477
  // Default encoding is now 'quoted-printable'
478
- addText({ data, encoding = "quoted-printable", charset = "UTF-8" }) {
479
- this._addBodyPart(data, "text/plain", encoding, charset);
478
+ addText({ data, encoding = "quoted-printable", charset = "UTF-8", autoMinify = false }) {
479
+ let finalData = data;
480
+ if (autoMinify && typeof finalData === "string") {
481
+ finalData = finalData.replace(/\s+/g, " ").trim();
482
+ }
483
+ this._addBodyPart(finalData, "text/plain", encoding, charset);
480
484
  }
481
485
 
482
486
  /**
@@ -491,7 +495,7 @@ class MimeMessage {
491
495
  data,
492
496
  encoding = "quoted-printable",
493
497
  autoTextPart = false,
494
- autoMinify = null,
498
+ autoMinify = true,
495
499
  markdownToHtml = false,
496
500
  charset = "UTF-8",
497
501
  }) {
@@ -532,8 +536,7 @@ class MimeMessage {
532
536
 
533
537
  let finalHtml = data;
534
538
 
535
- const shouldMinify = autoMinify !== null && autoMinify !== undefined ? autoMinify : (this.boundaryStyle !== "outlook");
536
- if (shouldMinify) {
539
+ if (autoMinify) {
537
540
  finalHtml = this._minifyHtml(finalHtml);
538
541
  }
539
542