nodemailer 8.0.5 → 8.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## [8.0.6](https://github.com/nodemailer/nodemailer/compare/v8.0.5...v8.0.6) (2026-04-24)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * restore base64 wrap() trim behavior to prevent trailing CRLF ([#1810](https://github.com/nodemailer/nodemailer/issues/1810)) ([#1811](https://github.com/nodemailer/nodemailer/issues/1811)) ([b1ae6c1](https://github.com/nodemailer/nodemailer/commit/b1ae6c1c2927240737d9f68f316f0c84042b8adb))
9
+
3
10
  ## [8.0.5](https://github.com/nodemailer/nodemailer/compare/v8.0.4...v8.0.5) (2026-04-07)
4
11
 
5
12
 
@@ -36,12 +36,12 @@ function wrap(str, lineLength) {
36
36
  const chunkLength = lineLength * 1024;
37
37
  const wrapRegex = new RegExp('.{' + lineLength + '}', 'g');
38
38
  while (pos < str.length) {
39
- const wrappedLines = str.substr(pos, chunkLength).replace(wrapRegex, '$&\r\n');
39
+ const wrappedLines = str.substr(pos, chunkLength).replace(wrapRegex, '$&\r\n').trim();
40
40
  result.push(wrappedLines);
41
41
  pos += chunkLength;
42
42
  }
43
43
 
44
- return result.join('');
44
+ return result.join('\r\n').trim();
45
45
  }
46
46
 
47
47
  /**
@@ -95,20 +95,17 @@ class Encoder extends Transform {
95
95
  if (this.options.lineLength) {
96
96
  b64 = wrap(b64, this.options.lineLength);
97
97
 
98
+ // remove last line as it is still most probably incomplete
98
99
  const lastLF = b64.lastIndexOf('\n');
99
100
  if (lastLF < 0) {
100
101
  this._curLine = b64;
101
102
  b64 = '';
103
+ } else if (lastLF === b64.length - 1) {
104
+ this._curLine = '';
102
105
  } else {
103
106
  this._curLine = b64.substring(lastLF + 1);
104
107
  b64 = b64.substring(0, lastLF + 1);
105
-
106
- if (b64 && !b64.endsWith('\r\n')) {
107
- b64 += '\r\n';
108
- }
109
108
  }
110
- } else {
111
- this._curLine = '';
112
109
  }
113
110
 
114
111
  if (b64) {
@@ -125,6 +122,7 @@ class Encoder extends Transform {
125
122
  }
126
123
 
127
124
  if (this._curLine) {
125
+ this._curLine = wrap(this._curLine, this.options.lineLength);
128
126
  this.outputBytes += this._curLine.length;
129
127
  this.push(Buffer.from(this._curLine, 'ascii'));
130
128
  this._curLine = '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodemailer",
3
- "version": "8.0.5",
3
+ "version": "8.0.6",
4
4
  "description": "Easy as cake e-mail sending from your Node.js applications",
5
5
  "main": "lib/nodemailer.js",
6
6
  "scripts": {